mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-15 21:37:09 +09:00
Merge
This commit is contained in:
@@ -1454,9 +1454,9 @@ func (h *BufPane) ClearInfo() bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Quit this will close the current tab or view that is open
|
// ForceQuit closes the current tab or view even if there are unsaved changes
|
||||||
func (h *BufPane) Quit() bool {
|
// (no prompt)
|
||||||
quit := func() {
|
func (h *BufPane) ForceQuit() bool {
|
||||||
h.Buf.Close()
|
h.Buf.Close()
|
||||||
if len(MainTab().Panes) > 1 {
|
if len(MainTab().Panes) > 1 {
|
||||||
h.Unsplit()
|
h.Unsplit()
|
||||||
@@ -1467,26 +1467,30 @@ func (h *BufPane) Quit() bool {
|
|||||||
InfoBar.Close()
|
InfoBar.Close()
|
||||||
runtime.Goexit()
|
runtime.Goexit()
|
||||||
}
|
}
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Quit this will close the current tab or view that is open
|
||||||
|
func (h *BufPane) Quit() bool {
|
||||||
if h.Buf.Modified() {
|
if h.Buf.Modified() {
|
||||||
if config.GlobalSettings["autosave"].(float64) > 0 {
|
if config.GlobalSettings["autosave"].(float64) > 0 {
|
||||||
// autosave on means we automatically save when quitting
|
// autosave on means we automatically save when quitting
|
||||||
h.SaveCB("Quit", func() {
|
h.SaveCB("Quit", func() {
|
||||||
quit()
|
h.ForceQuit()
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
InfoBar.YNPrompt("Save changes to "+h.Buf.GetName()+" before closing? (y,n,esc)", func(yes, canceled bool) {
|
InfoBar.YNPrompt("Save changes to "+h.Buf.GetName()+" before closing? (y,n,esc)", func(yes, canceled bool) {
|
||||||
if !canceled && !yes {
|
if !canceled && !yes {
|
||||||
quit()
|
h.ForceQuit()
|
||||||
} else if !canceled && yes {
|
} else if !canceled && yes {
|
||||||
h.SaveCB("Quit", func() {
|
h.SaveCB("Quit", func() {
|
||||||
quit()
|
h.ForceQuit()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
quit()
|
h.ForceQuit()
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -666,6 +666,7 @@ var BufKeyActions = map[string]BufKeyAction{
|
|||||||
"Escape": (*BufPane).Escape,
|
"Escape": (*BufPane).Escape,
|
||||||
"Quit": (*BufPane).Quit,
|
"Quit": (*BufPane).Quit,
|
||||||
"QuitAll": (*BufPane).QuitAll,
|
"QuitAll": (*BufPane).QuitAll,
|
||||||
|
"ForceQuit": (*BufPane).ForceQuit,
|
||||||
"AddTab": (*BufPane).AddTab,
|
"AddTab": (*BufPane).AddTab,
|
||||||
"PreviousTab": (*BufPane).PreviousTab,
|
"PreviousTab": (*BufPane).PreviousTab,
|
||||||
"NextTab": (*BufPane).NextTab,
|
"NextTab": (*BufPane).NextTab,
|
||||||
|
|||||||
Reference in New Issue
Block a user