Merge pull request #330 from mlang/goto

Edit: Bind M-< and M-> to gotoBOF and gotoEOF
This commit is contained in:
Jonathan Daugherty 2021-07-19 17:07:03 -07:00 committed by GitHub
commit 9a08fa1e9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -131,7 +131,7 @@ library
contravariant,
stm >= 2.4.3,
text,
text-zipper >= 0.7.1,
text-zipper >= 0.11,
template-haskell,
deepseq >= 1.3 && < 1.5,
unix,

View File

@ -59,8 +59,10 @@ import Brick.AttrMap
-- | Editor state. Editors support the following events by default:
--
-- * Ctrl-a: go to beginning of line
-- * Ctrl-e: go to end of line
-- * Meta-<: go to beginning of file
-- * Meta->: go to end of file
-- * Ctrl-a, Home: go to beginning of line
-- * Ctrl-e, End: go to end of line
-- * 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
@ -126,6 +128,8 @@ handleEditorEvent e ed =
EvKey KBS [] -> Z.deletePrevChar
EvKey KHome [] -> Z.gotoBOL
EvKey KEnd [] -> Z.gotoEOL
EvKey (KChar '<') [MMeta] -> Z.gotoBOF
EvKey (KChar '>') [MMeta] -> Z.gotoEOF
_ -> id
in return $ applyEdit f ed