Bind Ctrl-U to delete to BOL edit widget

Ctrl-u will now delete all text from the cursor position to the
beginning of the current line. This is a standard readline binding.
This commit is contained in:
Hans-Peter Deifel 2016-07-31 22:32:04 +02:00
parent 4cc231fa29
commit e6dc695932
2 changed files with 3 additions and 1 deletions

View File

@ -88,7 +88,7 @@ library
vector,
contravariant,
text,
text-zipper >= 0.2.1,
text-zipper >= 0.5,
template-haskell,
deepseq >= 1.3 && < 1.5

View File

@ -49,6 +49,7 @@ import Brick.AttrMap
-- * Ctrl-d, Del: delete character at cursor position
-- * Backspace: delete character prior to cursor position
-- * Ctrl-k: delete all from cursor to end of line
-- * Ctrl-u: delete all from cursor to beginning of line
-- * Arrow keys: move cursor
-- * Enter: break the current line at the cursor position
data Editor n =
@ -72,6 +73,7 @@ handleEditorEvent e ed =
EvKey (KChar 'e') [MCtrl] -> Z.gotoEOL
EvKey (KChar 'd') [MCtrl] -> Z.deleteChar
EvKey (KChar 'k') [MCtrl] -> Z.killToEOL
EvKey (KChar 'u') [MCtrl] -> Z.killToBOL
EvKey KEnter [] -> Z.breakLine
EvKey KDel [] -> Z.deleteChar
EvKey (KChar c) [] | c /= '\t' -> Z.insertChar c