if h.Buf.Path == "" {
h.SaveAs()
} else {
- h.saveBufToFile(h.Buf.Path, "Save")
+ noPrompt := h.saveBufToFile(h.Buf.Path, "Save")
+ if noPrompt {
+ return true
+ }
}
return false
InfoBar.Error("Error parsing arguments: ", err)
return
}
- h.saveBufToFile(filename, "SaveAs")
+ noPrompt := h.saveBufToFile(filename, "SaveAs")
+ if noPrompt {
+ h.completeAction("SaveAs")
+ }
}
})
return false
// This function saves the buffer to `filename` and changes the buffer's path and name
// to `filename` if the save is successful
-func (h *BufPane) saveBufToFile(filename string, action string) {
+func (h *BufPane) saveBufToFile(filename string, action string) bool {
err := h.Buf.SaveAs(filename)
if err != nil {
if strings.HasSuffix(err.Error(), "permission denied") {
h.completeAction(action)
}
})
+ return false
} else {
InfoBar.Error(err)
}
h.Buf.Path = filename
h.Buf.SetName(filename)
InfoBar.Message("Saved " + filename)
- h.completeAction(action)
}
+ return true
}
// Find opens a prompt and searches forward for the input