mirror of
https://github.com/rivo/tview.git
synced 2024-11-12 19:10:28 +00:00
Added more bash-like key bindings to InputField. Resolves #549
This commit is contained in:
parent
c3311ba972
commit
73a23207d2
@ -554,7 +554,7 @@ func (i *InputField) InputHandler() func(event *tcell.EventKey, setFocus func(p
|
|||||||
if i.offset >= i.cursorPos {
|
if i.offset >= i.cursorPos {
|
||||||
i.offset = 0
|
i.offset = 0
|
||||||
}
|
}
|
||||||
case tcell.KeyDelete: // Delete character after the cursor.
|
case tcell.KeyDelete, tcell.KeyCtrlD: // Delete character after the cursor.
|
||||||
iterateString(i.text[i.cursorPos:], func(main rune, comb []rune, textPos, textWidth, screenPos, screenWidth int) bool {
|
iterateString(i.text[i.cursorPos:], func(main rune, comb []rune, textPos, textWidth, screenPos, screenWidth int) bool {
|
||||||
i.text = i.text[:i.cursorPos] + i.text[i.cursorPos+textWidth:]
|
i.text = i.text[:i.cursorPos] + i.text[i.cursorPos+textWidth:]
|
||||||
return true
|
return true
|
||||||
@ -565,12 +565,16 @@ func (i *InputField) InputHandler() func(event *tcell.EventKey, setFocus func(p
|
|||||||
} else {
|
} else {
|
||||||
moveLeft()
|
moveLeft()
|
||||||
}
|
}
|
||||||
|
case tcell.KeyCtrlB:
|
||||||
|
moveLeft()
|
||||||
case tcell.KeyRight:
|
case tcell.KeyRight:
|
||||||
if event.Modifiers()&tcell.ModAlt > 0 {
|
if event.Modifiers()&tcell.ModAlt > 0 {
|
||||||
moveWordRight()
|
moveWordRight()
|
||||||
} else {
|
} else {
|
||||||
moveRight()
|
moveRight()
|
||||||
}
|
}
|
||||||
|
case tcell.KeyCtrlF:
|
||||||
|
moveRight()
|
||||||
case tcell.KeyHome, tcell.KeyCtrlA:
|
case tcell.KeyHome, tcell.KeyCtrlA:
|
||||||
home()
|
home()
|
||||||
case tcell.KeyEnd, tcell.KeyCtrlE:
|
case tcell.KeyEnd, tcell.KeyCtrlE:
|
||||||
|
Loading…
Reference in New Issue
Block a user