1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-15 00:15:32 +02:00

Remove line number support for "open" command

The "open" command is supposed to behave in the same way as double-clicking a
file in the Finder/Explorer. The concept of jumping to a specific line in the
file doesn't make sense for this; use "edit" instead.
This commit is contained in:
Stefan Haller
2023-03-28 18:19:03 +02:00
parent 2947b56134
commit 08d679c3a8
5 changed files with 4 additions and 17 deletions

View File

@ -10,7 +10,6 @@ type IFilesHelper interface {
EditFile(filename string) error
EditFileAtLine(filename string, lineNumber int) error
OpenFile(filename string) error
OpenFileAtLine(filename string, lineNumber int) error
}
type FilesHelper struct {
@ -63,12 +62,8 @@ func (self *FilesHelper) callEditor(cmdStr string, editInTerminal bool) error {
}
func (self *FilesHelper) OpenFile(filename string) error {
return self.OpenFileAtLine(filename, 1)
}
func (self *FilesHelper) OpenFileAtLine(filename string, lineNumber int) error {
self.c.LogAction(self.c.Tr.Actions.OpenFile)
if err := self.os.OpenFileAtLine(filename, lineNumber); err != nil {
if err := self.os.OpenFile(filename); err != nil {
return self.c.Error(err)
}
return nil