summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Haller <stefan@haller-berlin.de>2023-03-28 17:49:55 +0200
committerStefan Haller <stefan@haller-berlin.de>2023-04-13 13:14:00 +0200
commit2947b5613417a38a09cd8ac0ede49eff78d80ec6 (patch)
tree47b8d112c40d8e9d6e83b1c54b6085c82c360ad9
parent659d668e16c3aac63ca7c41bba06003b6b1f8023 (diff)
Add support for falling back to legacy edit config
-rw-r--r--pkg/commands/git_commands/file.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/pkg/commands/git_commands/file.go b/pkg/commands/git_commands/file.go
index 3ceef2d9b..94563be65 100644
--- a/pkg/commands/git_commands/file.go
+++ b/pkg/commands/git_commands/file.go
@@ -76,6 +76,13 @@ func (self *FileCommands) GetEditCmdStrLegacy(filename string, lineNumber int) (
}
func (self *FileCommands) GetEditCmdStr(filename string) (string, bool) {
+ // Legacy support for old config; to be removed at some point
+ if self.UserConfig.OS.Edit == "" && self.UserConfig.OS.EditCommandTemplate != "" {
+ if cmdStr, err := self.GetEditCmdStrLegacy(filename, 1); err == nil {
+ return cmdStr, true
+ }
+ }
+
template, editInTerminal := config.GetEditTemplate(&self.UserConfig.OS, self.guessDefaultEditor)
templateValues := map[string]string{
@@ -87,6 +94,13 @@ func (self *FileCommands) GetEditCmdStr(filename string) (string, bool) {
}
func (self *FileCommands) GetEditAtLineCmdStr(filename string, lineNumber int) (string, bool) {
+ // Legacy support for old config; to be removed at some point
+ if self.UserConfig.OS.EditAtLine == "" && self.UserConfig.OS.EditCommandTemplate != "" {
+ if cmdStr, err := self.GetEditCmdStrLegacy(filename, lineNumber); err == nil {
+ return cmdStr, true
+ }
+ }
+
template, editInTerminal := config.GetEditAtLineTemplate(&self.UserConfig.OS, self.guessDefaultEditor)
templateValues := map[string]string{
@@ -99,6 +113,13 @@ func (self *FileCommands) GetEditAtLineCmdStr(filename string, lineNumber int) (
}
func (self *FileCommands) GetEditAtLineAndWaitCmdStr(filename string, lineNumber int) string {
+ // Legacy support for old config; to be removed at some point
+ if self.UserConfig.OS.EditAtLineAndWait == "" && self.UserConfig.OS.EditCommandTemplate != "" {
+ if cmdStr, err := self.GetEditCmdStrLegacy(filename, lineNumber); err == nil {
+ return cmdStr
+ }
+ }
+
template := config.GetEditAtLineAndWaitTemplate(&self.UserConfig.OS, self.guessDefaultEditor)
templateValues := map[string]string{