Skip to content

Commit f934a4f

Browse files
committed
actions: Execute possible callbacks on Y/N prompts
1 parent ec8bb7c commit f934a4f

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

internal/action/actions.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,7 +1012,11 @@ func (h *BufPane) SaveAsCB(action string, callback func()) bool {
10121012
InfoBar.YNPrompt(
10131013
fmt.Sprintf("The file %s already exists in the directory, would you like to overwrite? Y/n", fileinfo.Name()),
10141014
func(yes, canceled bool) {
1015-
if yes && !canceled {
1015+
if !yes && !canceled {
1016+
if callback != nil {
1017+
callback()
1018+
}
1019+
} else if yes && !canceled {
10161020
noPrompt := h.saveBufToFile(filename, action, callback)
10171021
if noPrompt {
10181022
h.completeAction(action)
@@ -1060,7 +1064,11 @@ func (h *BufPane) saveBufToFile(filename string, action string, callback func())
10601064
InfoBar.YNPrompt(
10611065
fmt.Sprintf("Permission denied. Do you want to save this file using %s? (y,n)", config.GlobalSettings["sucmd"].(string)),
10621066
func(yes, canceled bool) {
1063-
if yes && !canceled {
1067+
if !yes && !canceled {
1068+
if callback != nil {
1069+
callback()
1070+
}
1071+
} else if yes && !canceled {
10641072
saveWithSudo()
10651073
h.completeAction(action)
10661074
}

0 commit comments

Comments
 (0)