mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-15 21:37:09 +09:00
YN callbacks and better multi cursor
This commit is contained in:
@@ -34,10 +34,18 @@ func (h *InfoHandler) HandleEvent(event tcell.Event) {
|
||||
|
||||
done := h.DoKeyEvent(ke)
|
||||
if !done && e.Key() == tcell.KeyRune {
|
||||
h.DoRuneInsert(e.Rune())
|
||||
done = true
|
||||
if e.Rune() == 'y' && h.HasYN {
|
||||
h.YNResp = true
|
||||
h.DonePrompt(false)
|
||||
} else if e.Rune() == 'n' && h.HasYN {
|
||||
h.YNResp = false
|
||||
h.DonePrompt(false)
|
||||
} else if !h.HasYN {
|
||||
h.DoRuneInsert(e.Rune())
|
||||
done = true
|
||||
}
|
||||
}
|
||||
if done && h.HasPrompt {
|
||||
if done && h.HasPrompt && !h.HasYN {
|
||||
resp := strings.TrimSpace(string(h.LineBytes(0)))
|
||||
hist := h.History[h.PromptType]
|
||||
hist[h.HistoryNum] = resp
|
||||
@@ -144,7 +152,9 @@ func (h *InfoHandler) InsertTab() {
|
||||
// TODO: autocomplete
|
||||
}
|
||||
func (h *InfoHandler) InsertNewline() {
|
||||
h.DonePrompt(false)
|
||||
if !h.HasYN {
|
||||
h.DonePrompt(false)
|
||||
}
|
||||
}
|
||||
func (h *InfoHandler) Quit() {
|
||||
h.DonePrompt(true)
|
||||
|
||||
Reference in New Issue
Block a user