mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-06-06 23:46:13 +02:00
Honour editInTerminal value when opening a worktree folder
There was no good reason not to do this in the first place.
This commit is contained in:
parent
cdea5b4873
commit
9e7018db8a
@ -131,15 +131,15 @@ func (self *FileCommands) GetEditAtLineAndWaitCmdStr(filename string, lineNumber
|
|||||||
return cmdStr
|
return cmdStr
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *FileCommands) GetOpenDirInEditorCmdStr(path string) string {
|
func (self *FileCommands) GetOpenDirInEditorCmdStr(path string) (string, bool) {
|
||||||
template := config.GetOpenDirInEditorTemplate(&self.UserConfig.OS, self.guessDefaultEditor)
|
template, editInTerminal := config.GetOpenDirInEditorTemplate(&self.UserConfig.OS, self.guessDefaultEditor)
|
||||||
|
|
||||||
templateValues := map[string]string{
|
templateValues := map[string]string{
|
||||||
"dir": self.cmd.Quote(path),
|
"dir": self.cmd.Quote(path),
|
||||||
}
|
}
|
||||||
|
|
||||||
cmdStr := utils.ResolvePlaceholderString(template, templateValues)
|
cmdStr := utils.ResolvePlaceholderString(template, templateValues)
|
||||||
return cmdStr
|
return cmdStr, editInTerminal
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *FileCommands) guessDefaultEditor() string {
|
func (self *FileCommands) guessDefaultEditor() string {
|
||||||
|
@ -28,13 +28,13 @@ func GetEditAtLineAndWaitTemplate(osConfig *OSConfig, guessDefaultEditor func()
|
|||||||
return template
|
return template
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetOpenDirInEditorTemplate(osConfig *OSConfig, guessDefaultEditor func() string) string {
|
func GetOpenDirInEditorTemplate(osConfig *OSConfig, guessDefaultEditor func() string) (string, bool) {
|
||||||
preset := getPreset(osConfig, guessDefaultEditor)
|
preset := getPreset(osConfig, guessDefaultEditor)
|
||||||
template := osConfig.OpenDirInEditor
|
template := osConfig.OpenDirInEditor
|
||||||
if template == "" {
|
if template == "" {
|
||||||
template = preset.openDirInEditorTemplate
|
template = preset.openDirInEditorTemplate
|
||||||
}
|
}
|
||||||
return template
|
return template, getEditInTerminal(osConfig, preset)
|
||||||
}
|
}
|
||||||
|
|
||||||
type editPreset struct {
|
type editPreset struct {
|
||||||
|
@ -38,10 +38,9 @@ func (self *FilesHelper) EditFileAtLineAndWait(filename string, lineNumber int)
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (self *FilesHelper) OpenDirInEditor(path string) error {
|
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, editInTerminal)
|
||||||
return self.callEditor(cmdStr, false)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *FilesHelper) callEditor(cmdStr string, editInTerminal bool) error {
|
func (self *FilesHelper) callEditor(cmdStr string, editInTerminal bool) error {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user