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

Fix Backspace key to emit BSpace and AltBS events instead of CtrlH

CtrlH events are still sent when appropriate. I have adjusted
FullscreenRenderer to match the LightRenderer's behaviour, which seems
to be correct.
This commit is contained in:
Vlastimil Ovčáčík
2021-09-21 11:09:04 +02:00
committed by Junegunn Choi
parent 09700f676b
commit ca43f95fb1
2 changed files with 26 additions and 10 deletions

View File

@@ -223,6 +223,7 @@ func (r *FullscreenRenderer) GetChar() Event {
// process keyboard:
case *tcell.EventKey:
mods := ev.Modifiers()
none := mods == tcell.ModNone
alt := (mods & tcell.ModAlt) > 0
ctrl := (mods & tcell.ModCtrl) > 0
shift := (mods & tcell.ModShift) > 0
@@ -252,7 +253,21 @@ func (r *FullscreenRenderer) GetChar() Event {
case tcell.KeyCtrlG:
return keyfn('g')
case tcell.KeyCtrlH:
return keyfn('h')
switch ev.Rune() {
case 0:
if ctrl {
return Event{BSpace, 0, nil}
}
case rune(tcell.KeyCtrlH):
switch {
case ctrl:
return keyfn('h')
case alt:
return Event{AltBS, 0, nil}
case none, shift:
return Event{BSpace, 0, nil}
}
}
case tcell.KeyCtrlI:
return keyfn('i')
case tcell.KeyCtrlJ: