Caps lock issue#658 (#659)

* caps-lock-issue #658

* when esc key is pressed the message is cleared away
This commit is contained in:
Tommy
2017-05-10 15:02:17 +01:00
committed by Zachary Yedidia
parent ef0f506b6f
commit 7c80de7ee1
2 changed files with 10 additions and 7 deletions

View File

@@ -199,18 +199,19 @@ func (v *View) ScrollDown(n int) {
// causing them to lose the unsaved changes
func (v *View) CanClose() bool {
if v.Type == vtDefault && v.Buf.IsModified {
var char rune
var choice bool
var canceled bool
if v.Buf.Settings["autosave"].(bool) {
char = 'y'
choice = true
} else {
char, canceled = messenger.LetterPrompt("Save changes to "+v.Buf.GetName()+" before closing? (y,n,esc) ", 'y', 'n', 'Y', 'N')
choice, canceled = messenger.YesNoPrompt("Save changes to " + v.Buf.GetName() + " before closing? (y,n,esc) ")
}
if !canceled {
if char == 'y' || char == 'Y' {
//if char == 'y' {
if choice {
v.Save(true)
return true
} else if char == 'n' || char == 'N' {
} else {
return true
}
}