ui: probably more effective redraw when pressing Ctrl-l
Now uses vtyRefresh.
This commit is contained in:
		
							parent
							
								
									faa5b0fba7
								
							
						
					
					
						commit
						bb5d6c47c6
					
				| @ -337,7 +337,7 @@ asHandle ui0@UIState{ | |||||||
|         VtyEvent (EvKey (KChar '/') []) -> continue $ regenerateScreens j d $ showMinibuffer ui |         VtyEvent (EvKey (KChar '/') []) -> continue $ regenerateScreens j d $ showMinibuffer ui | ||||||
|         VtyEvent (EvKey k           []) | k `elem` [KBS, KDel] -> (continue $ regenerateScreens j d $ resetFilter ui) |         VtyEvent (EvKey k           []) | k `elem` [KBS, KDel] -> (continue $ regenerateScreens j d $ resetFilter ui) | ||||||
|         VtyEvent e | e `elem` moveLeftEvents -> continue $ popScreen ui |         VtyEvent e | e `elem` moveLeftEvents -> continue $ popScreen ui | ||||||
|         VtyEvent (EvKey (KChar 'l') [MCtrl]) -> scrollSelectionToMiddle _asList >> invalidateCache >> continue ui |         VtyEvent (EvKey (KChar 'l') [MCtrl]) -> scrollSelectionToMiddle _asList >> redraw ui | ||||||
| 
 | 
 | ||||||
|         -- enter register screen for selected account (if there is one),  |         -- enter register screen for selected account (if there is one),  | ||||||
|         -- centering its selected transaction if possible |         -- centering its selected transaction if possible | ||||||
|  | |||||||
| @ -333,7 +333,7 @@ rsHandle ui@UIState{ | |||||||
|         VtyEvent (EvKey (KLeft)     [MShift]) -> continue $ regenerateScreens j d $ previousReportPeriod journalspan ui |         VtyEvent (EvKey (KLeft)     [MShift]) -> continue $ regenerateScreens j d $ previousReportPeriod journalspan ui | ||||||
|         VtyEvent (EvKey k           []) | k `elem` [KBS, KDel] -> (continue $ regenerateScreens j d $ resetFilter ui) |         VtyEvent (EvKey k           []) | k `elem` [KBS, KDel] -> (continue $ regenerateScreens j d $ resetFilter ui) | ||||||
|         VtyEvent e | e `elem` moveLeftEvents  -> continue $ popScreen ui |         VtyEvent e | e `elem` moveLeftEvents  -> continue $ popScreen ui | ||||||
|         VtyEvent (EvKey (KChar 'l') [MCtrl]) -> scrollSelectionToMiddle rsList >> invalidateCache >> continue ui |         VtyEvent (EvKey (KChar 'l') [MCtrl]) -> scrollSelectionToMiddle rsList >> redraw ui | ||||||
| 
 | 
 | ||||||
|         -- enter transaction screen for selected transaction |         -- enter transaction screen for selected transaction | ||||||
|         VtyEvent e | e `elem` moveRightEvents -> do |         VtyEvent e | e `elem` moveRightEvents -> do | ||||||
|  | |||||||
| @ -21,6 +21,7 @@ module Hledger.UI.UIUtils ( | |||||||
|   ,renderToggle |   ,renderToggle | ||||||
|   ,replaceHiddenAccountsNameWith |   ,replaceHiddenAccountsNameWith | ||||||
|   ,scrollSelectionToMiddle |   ,scrollSelectionToMiddle | ||||||
|  |   ,redraw | ||||||
| ) | ) | ||||||
| where | where | ||||||
| 
 | 
 | ||||||
| @ -36,7 +37,10 @@ import Data.Maybe | |||||||
| #if !(MIN_VERSION_base(4,11,0)) | #if !(MIN_VERSION_base(4,11,0)) | ||||||
| import Data.Monoid | import Data.Monoid | ||||||
| #endif | #endif | ||||||
| import Graphics.Vty (Event(..),Key(..),Modifier(..),Color,Attr,currentAttr) | import Graphics.Vty | ||||||
|  |   (Event(..),Key(..),Modifier(..),Vty(..),Color,Attr,currentAttr,refresh | ||||||
|  |   -- ,Output(displayBounds,mkDisplayContext),DisplayContext(..) | ||||||
|  |   ) | ||||||
| import Lens.Micro.Platform | import Lens.Micro.Platform | ||||||
| import System.Environment | import System.Environment | ||||||
| 
 | 
 | ||||||
| @ -47,6 +51,10 @@ import Hledger.UI.UITypes | |||||||
| import Hledger.UI.UIState | import Hledger.UI.UIState | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | -- | Tell vty to redraw the whole screen, and continue. | ||||||
|  | redraw :: s -> EventM a (Next s) | ||||||
|  | redraw ui = getVtyHandle >>= liftIO . refresh >> continue ui | ||||||
|  | 
 | ||||||
| -- ui | -- ui | ||||||
| 
 | 
 | ||||||
| -- | Wrap a widget in the default hledger-ui screen layout. | -- | Wrap a widget in the default hledger-ui screen layout. | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user