mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-16 22:07:09 +09:00
@@ -1322,6 +1322,39 @@ func (v *View) Quit(usePlugin bool) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// QuitAll quits the whole editor; all splits and tabs
|
||||
func (v *View) QuitAll(usePlugin bool) bool {
|
||||
if usePlugin && !PreActionCall("QuitAll", v) {
|
||||
return false
|
||||
}
|
||||
|
||||
closeAll := true
|
||||
for _, tab := range tabs {
|
||||
for _, v := range tab.views {
|
||||
if !v.CanClose("Quit anyway? (y,n,s) ", 'y', 'n', 's') {
|
||||
closeAll = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if closeAll {
|
||||
for _, tab := range tabs {
|
||||
for _, v := range tab.views {
|
||||
v.CloseBuffer()
|
||||
}
|
||||
}
|
||||
|
||||
if usePlugin {
|
||||
PostActionCall("QuitAll", v)
|
||||
}
|
||||
|
||||
screen.Fini()
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// AddTab adds a new tab with an empty buffer
|
||||
func (v *View) AddTab(usePlugin bool) bool {
|
||||
if usePlugin && !PreActionCall("AddTab", v) {
|
||||
|
||||
@@ -72,6 +72,7 @@ var bindingActions = map[string]func(*View, bool) bool{
|
||||
"ShellMode": (*View).ShellMode,
|
||||
"CommandMode": (*View).CommandMode,
|
||||
"Quit": (*View).Quit,
|
||||
"QuitAll": (*View).QuitAll,
|
||||
"AddTab": (*View).AddTab,
|
||||
"PreviousTab": (*View).PreviousTab,
|
||||
"NextTab": (*View).NextTab,
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -169,6 +169,7 @@ ClearStatus
|
||||
ShellMode
|
||||
CommandMode
|
||||
Quit
|
||||
QuitAll
|
||||
AddTab
|
||||
PreviousTab
|
||||
NextTab
|
||||
|
||||
Reference in New Issue
Block a user