mirror of
https://github.com/zyedidia/micro.git
synced 2026-02-06 23:20:18 +09:00
@@ -117,7 +117,7 @@ func HandleCommand(input string, view *View) {
|
||||
case "set":
|
||||
SetOption(view, args)
|
||||
case "quit":
|
||||
if view.CanClose("Quit anyway? ") {
|
||||
if view.CanClose("Quit anyway? (yes, no, save) ") {
|
||||
screen.Fini()
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ func main() {
|
||||
switch e.Key() {
|
||||
case tcell.KeyCtrlQ:
|
||||
// Make sure not to quit if there are unsaved changes
|
||||
if view.CanClose("Quit anyway? ") {
|
||||
if view.CanClose("Quit anyway? (yes, no, save) ") {
|
||||
screen.Fini()
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
@@ -196,6 +196,9 @@ func (v *View) CanClose(msg string) bool {
|
||||
if !canceled {
|
||||
if strings.ToLower(quit) == "yes" || strings.ToLower(quit) == "y" {
|
||||
return true
|
||||
} else if strings.ToLower(quit) == "save" || strings.ToLower(quit) == "s" {
|
||||
v.Save()
|
||||
return true
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -276,7 +279,7 @@ func (v *View) SelectAll() {
|
||||
// OpenFile opens a new file in the current view
|
||||
// It makes sure that the current buffer can be closed first (unsaved changes)
|
||||
func (v *View) OpenFile() {
|
||||
if v.CanClose("Continue? ") {
|
||||
if v.CanClose("Continue? (yes, no, save) ") {
|
||||
filename, canceled := messenger.Prompt("File to open: ")
|
||||
if canceled {
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user