m/fzf
1
0
mirror of https://github.com/junegunn/fzf.git synced 2025-11-17 07:43:39 -05:00

Add ability to type AltGr characters in FullscreenRenderer on Windows.

This commit is contained in:
Vlastimil Ovčáčík
2021-09-19 23:48:31 +02:00
committed by Junegunn Choi
parent 00fb486f6a
commit f3dc8a10d5
2 changed files with 32 additions and 17 deletions

View File

@@ -224,8 +224,11 @@ func (r *FullscreenRenderer) GetChar() Event {
case *tcell.EventKey:
mods := ev.Modifiers()
alt := (mods & tcell.ModAlt) > 0
ctrl := (mods & tcell.ModCtrl) > 0
shift := (mods & tcell.ModShift) > 0
ctrlAlt := ctrl && alt
altShift := alt && shift
keyfn := func(r rune) Event {
if alt {
return CtrlAltKey(r)
@@ -388,13 +391,20 @@ func (r *FullscreenRenderer) GetChar() Event {
case tcell.KeyF12:
return Event{F12, 0, nil}
// section 6: (Alt)+'rune'
// section 6: (Ctrl+Alt)+'rune'
case tcell.KeyRune:
r := ev.Rune()
if alt {
switch {
// handle AltGr characters
case ctrlAlt:
return Event{Rune, r, nil} // dropping modifiers
// simple characters (possibly with modifier)
case alt:
return AltKey(r)
default:
return Event{Rune, r, nil}
}
return Event{Rune, r, nil}
// section 7: Esc
case tcell.KeyEsc: