mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-25 18:07:07 +09:00
Don't use tcell's Rune() for non-KeyRune events
According to tcell documentation, Rune() should only be used for KeyRune events. Otherwise its return value is not guaranteed and should not be relied upon. This fixes issue #2947: Esc key not working on Windows, since tcell sends lone Esc key event with rune == 0 on Unix but with rune == 27 (the keycode) on Windows.
This commit is contained in:
@@ -128,7 +128,9 @@ func (t *TermPane) HandleEvent(event tcell.Event) {
|
||||
ke := KeyEvent{
|
||||
code: e.Key(),
|
||||
mod: metaToAlt(e.Modifiers()),
|
||||
r: e.Rune(),
|
||||
}
|
||||
if e.Key() == tcell.KeyRune {
|
||||
ke.r = e.Rune()
|
||||
}
|
||||
action, more := TermBindings.NextEvent(ke, nil)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user