diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2023-08-09 20:59:46 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2023-08-09 21:00:27 +1000 |
commit | 9e7018db8a63c4ddbd073e0967151eb05a75c84b (patch) | |
tree | 61a8e7cf9390717318915a6f67670d8abb90eecc /pkg | |
parent | cdea5b4873d92e14eea2302f6823e23efaf678f6 (diff) |
Honour editInTerminal value when opening a worktree folder
There was no good reason not to do this in the first place.
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/commands/git_commands/file.go | 6 | ||||
-rw-r--r-- | pkg/config/editor_presets.go | 4 | ||||
-rw-r--r-- | pkg/gui/controllers/helpers/files_helper.go | 5 |
3 files changed, 7 insertions, 8 deletions
diff --git a/pkg/commands/git_commands/file.go b/pkg/commands/git_commands/file.go index 7efdb567a..9fd5e8929 100644 --- a/pkg/commands/git_commands/file.go +++ b/pkg/commands/git_commands/file.go @@ -131,15 +131,15 @@ func (self *FileCommands) GetEditAtLineAndWaitCmdStr(filename string, lineNumber return cmdStr } -func (self *FileCommands) GetOpenDirInEditorCmdStr(path string) string { - template := config.GetOpenDirInEditorTemplate(&self.UserConfig.OS, self.guessDefaultEditor) +func (self *FileCommands) GetOpenDirInEditorCmdStr(path string) (string, bool) { + template, editInTerminal := config.GetOpenDirInEditorTemplate(&self.UserConfig.OS, self.guessDefaultEditor) templateValues := map[string]string{ "dir": self.cmd.Quote(path), } cmdStr := utils.ResolvePlaceholderString(template, templateValues) - return cmdStr + return cmdStr, editInTerminal } func (self *FileCommands) guessDefaultEditor() string { diff --git a/pkg/config/editor_presets.go b/pkg/config/editor_presets.go index 121401424..92374280b 100644 --- a/pkg/config/editor_presets.go +++ b/pkg/config/editor_presets.go @@ -28,13 +28,13 @@ func GetEditAtLineAndWaitTemplate(osConfig *OSConfig, guessDefaultEditor func() return template } -func GetOpenDirInEditorTemplate(osConfig *OSConfig, guessDefaultEditor func() string) string { +func GetOpenDirInEditorTemplate(osConfig *OSConfig, guessDefaultEditor func() string) (string, bool) { preset := getPreset(osConfig, guessDefaultEditor) template := osConfig.OpenDirInEditor if template == "" { template = preset.openDirInEditorTemplate } - return template + return template, getEditInTerminal(osConfig, preset) } type editPreset struct { diff --git a/pkg/gui/controllers/helpers/files_helper.go b/pkg/gui/controllers/helpers/files_helper.go index 8f9a816f8..18c7bcedc 100644 --- a/pkg/gui/controllers/helpers/files_helper.go +++ b/pkg/gui/controllers/helpers/files_helper.go @@ -38,10 +38,9 @@ func (self *FilesHelper) EditFileAtLineAndWait(filename string, lineNumber int) } func (self *FilesHelper) OpenDirInEditor(path string) error { - cmdStr := self.c.Git().File.GetOpenDirInEditorCmdStr(path) + cmdStr, editInTerminal := self.c.Git().File.GetOpenDirInEditorCmdStr(path) - // Not editing in terminal because surely that's not a thing. - return self.callEditor(cmdStr, false) + return self.callEditor(cmdStr, editInTerminal) } func (self *FilesHelper) callEditor(cmdStr string, editInTerminal bool) error { |