mirror of
https://github.com/simonmichael/hledger.git
synced 2024-11-08 07:09:28 +03:00
ui: support ctrl-l everywhere
This commit is contained in:
parent
bb5d6c47c6
commit
c02647d05e
@ -276,6 +276,7 @@ asHandle ui0@UIState{
|
||||
VtyEvent (EvKey KEsc []) -> continue $ closeMinibuffer ui
|
||||
VtyEvent (EvKey KEnter []) -> continue $ regenerateScreens j d $ setFilter s $ closeMinibuffer ui
|
||||
where s = chomp $ unlines $ map strip $ getEditContents ed
|
||||
VtyEvent (EvKey (KChar 'l') [MCtrl]) -> redraw ui
|
||||
VtyEvent ev -> do ed' <- handleEditorEvent ev ed
|
||||
continue $ ui{aMode=Minibuffer ed'}
|
||||
AppEvent _ -> continue ui
|
||||
@ -285,6 +286,7 @@ asHandle ui0@UIState{
|
||||
Help ->
|
||||
case ev of
|
||||
VtyEvent (EvKey (KChar 'q') []) -> halt ui
|
||||
VtyEvent (EvKey (KChar 'l') [MCtrl]) -> redraw ui
|
||||
_ -> helpHandle ui ev
|
||||
|
||||
Normal ->
|
||||
|
@ -20,7 +20,7 @@ import Data.Monoid
|
||||
#endif
|
||||
import Data.Time.Calendar (Day)
|
||||
import Data.Void (Void)
|
||||
import Graphics.Vty (Event(..),Key(..))
|
||||
import Graphics.Vty (Event(..),Key(..),Modifier(..))
|
||||
import Text.Megaparsec
|
||||
import Text.Megaparsec.Char
|
||||
|
||||
@ -85,6 +85,7 @@ esHandle ui@UIState{aScreen=ErrorScreen{..}
|
||||
Help ->
|
||||
case ev of
|
||||
VtyEvent (EvKey (KChar 'q') []) -> halt ui
|
||||
VtyEvent (EvKey (KChar 'l') [MCtrl]) -> redraw ui
|
||||
_ -> helpHandle ui ev
|
||||
|
||||
_ -> do
|
||||
@ -105,6 +106,7 @@ esHandle ui@UIState{aScreen=ErrorScreen{..}
|
||||
-- Left err -> continue ui{aScreen=s{esError=err}} -- show latest parse error
|
||||
-- Right j' -> continue $ regenerateScreens j' d $ popScreen ui -- return to previous screen, and reload it
|
||||
VtyEvent (EvKey (KChar 'I') []) -> continue $ uiCheckBalanceAssertions d (popScreen $ toggleIgnoreBalanceAssertions ui)
|
||||
VtyEvent (EvKey (KChar 'l') [MCtrl]) -> redraw ui
|
||||
_ -> continue ui
|
||||
|
||||
esHandle _ _ = error "event handler called with wrong screen type, should not happen"
|
||||
|
@ -281,6 +281,7 @@ rsHandle ui@UIState{
|
||||
VtyEvent (EvKey KEsc []) -> continue $ closeMinibuffer ui
|
||||
VtyEvent (EvKey KEnter []) -> continue $ regenerateScreens j d $ setFilter s $ closeMinibuffer ui
|
||||
where s = chomp $ unlines $ map strip $ getEditContents ed
|
||||
VtyEvent (EvKey (KChar 'l') [MCtrl]) -> redraw ui
|
||||
VtyEvent ev -> do ed' <- handleEditorEvent ev ed
|
||||
continue $ ui{aMode=Minibuffer ed'}
|
||||
AppEvent _ -> continue ui
|
||||
@ -290,6 +291,7 @@ rsHandle ui@UIState{
|
||||
Help ->
|
||||
case ev of
|
||||
VtyEvent (EvKey (KChar 'q') []) -> halt ui
|
||||
VtyEvent (EvKey (KChar 'l') [MCtrl]) -> redraw ui
|
||||
_ -> helpHandle ui ev
|
||||
|
||||
Normal ->
|
||||
|
@ -17,7 +17,7 @@ import Data.Monoid
|
||||
#endif
|
||||
import qualified Data.Text as T
|
||||
import Data.Time.Calendar (Day)
|
||||
import Graphics.Vty (Event(..),Key(..))
|
||||
import Graphics.Vty (Event(..),Key(..),Modifier(..))
|
||||
import Brick
|
||||
import Brick.Widgets.List (listMoveTo)
|
||||
|
||||
@ -119,6 +119,7 @@ tsHandle ui@UIState{aScreen=s@TransactionScreen{tsTransaction=(i,t)
|
||||
Help ->
|
||||
case ev of
|
||||
VtyEvent (EvKey (KChar 'q') []) -> halt ui
|
||||
VtyEvent (EvKey (KChar 'l') [MCtrl]) -> redraw ui
|
||||
_ -> helpHandle ui ev
|
||||
|
||||
_ -> do
|
||||
@ -178,6 +179,7 @@ tsHandle ui@UIState{aScreen=s@TransactionScreen{tsTransaction=(i,t)
|
||||
where
|
||||
ui'@UIState{aScreen=scr} = popScreen ui
|
||||
ui'' = ui'{aScreen=rsSelect (fromIntegral i) scr}
|
||||
VtyEvent (EvKey (KChar 'l') [MCtrl]) -> redraw ui
|
||||
_ -> continue ui
|
||||
|
||||
tsHandle _ _ = error "event handler called with wrong screen type, should not happen"
|
||||
|
Loading…
Reference in New Issue
Block a user