if h.Buf.Path == "" {
h.SaveAs()
} else {
- h.saveBufToFile(h.Buf.Path)
+ h.saveBufToFile(h.Buf.Path, "Save")
}
- return true
+ return false
}
// SaveAs saves the buffer to disk with the given name
InfoBar.Error("Error parsing arguments: ", err)
return
}
- h.saveBufToFile(filename)
-
+ h.saveBufToFile(filename, "SaveAs")
}
})
- return true
+ 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) {
+func (h *BufPane) saveBufToFile(filename string, action string) {
err := h.Buf.SaveAs(filename)
if err != nil {
if strings.HasSuffix(err.Error(), "permission denied") {
h.Buf.SetName(filename)
InfoBar.Message("Saved " + filename)
}
+ h.completeAction(action)
}
})
} else {
h.Buf.Path = filename
h.Buf.SetName(filename)
InfoBar.Message("Saved " + filename)
+ h.completeAction(action)
}
}
_, isMulti := MultiActions[name]
if (!isMulti && cursor == 0) || isMulti {
if h.PluginCB("pre" + name) {
- asuccess := action(h)
- psuccess := h.PluginCB("on" + name)
+ success := action(h)
+ success = success && h.PluginCB("on"+name)
if isMulti {
if recording_macro {
}
}
- return asuccess && psuccess
+ return success
}
}
return false
}
+func (h *BufPane) completeAction(action string) {
+ h.PluginCB("on" + action)
+}
+
func (h *BufPane) HasKeyEvent(e Event) bool {
_, ok := BufKeyBindings[e]
return ok