ui: transaction: fix pattern match failure when pressing E (fixes #508)
This commit is contained in:
		
							parent
							
								
									600132445c
								
							
						
					
					
						commit
						7dd34d71b5
					
				| @ -211,6 +211,7 @@ instance NFData Posting | |||||||
| instance Eq Posting where | instance Eq Posting where | ||||||
|     (==) (Posting a1 b1 c1 d1 e1 f1 g1 h1 i1 _ _) (Posting a2 b2 c2 d2 e2 f2 g2 h2 i2 _ _) =  a1==a2 && b1==b2 && c1==c2 && d1==d2 && e1==e2 && f1==f2 && g1==g2 && h1==h2 && i1==i2 |     (==) (Posting a1 b1 c1 d1 e1 f1 g1 h1 i1 _ _) (Posting a2 b2 c2 d2 e2 f2 g2 h2 i2 _ _) =  a1==a2 && b1==b2 && c1==c2 && d1==d2 && e1==e2 && f1==f2 && g1==g2 && h1==h2 && i1==i2 | ||||||
| 
 | 
 | ||||||
|  | -- TODO: needs renaming, or removal if no longer needed. See also TextPosition in Hledger.UI.Editor | ||||||
| -- | The position of parse errors (eg), like parsec's SourcePos but generic. | -- | The position of parse errors (eg), like parsec's SourcePos but generic. | ||||||
| data GenericSourcePos = GenericSourcePos FilePath Int Int    -- ^ name, 1-based line number and 1-based column number. | data GenericSourcePos = GenericSourcePos FilePath Int Int    -- ^ name, 1-based line number and 1-based column number. | ||||||
|                       | JournalSourcePos FilePath (Int, Int) -- ^ file name, inclusive range of 1-based line numbers (first, last). |                       | JournalSourcePos FilePath (Int, Int) -- ^ file name, inclusive range of 1-based line numbers (first, last). | ||||||
|  | |||||||
| @ -128,7 +128,9 @@ tsHandle ui@UIState{aScreen=s@TransactionScreen{tsTransaction=(i,t) | |||||||
|         VtyEvent (EvKey (KChar c)   []) | c `elem` ['?'] -> continue $ setMode Help ui |         VtyEvent (EvKey (KChar c)   []) | c `elem` ['?'] -> continue $ setMode Help ui | ||||||
|         VtyEvent (EvKey (KChar 'E') []) -> suspendAndResume $ void (runEditor pos f) >> uiReloadJournalIfChanged copts d j ui |         VtyEvent (EvKey (KChar 'E') []) -> suspendAndResume $ void (runEditor pos f) >> uiReloadJournalIfChanged copts d j ui | ||||||
|           where |           where | ||||||
|             (pos,f) = let GenericSourcePos f l c = tsourcepos t in (Just (l, Just c),f) |             (pos,f) = case tsourcepos t of | ||||||
|  |                         GenericSourcePos f l c    -> (Just (l, Just c),f) | ||||||
|  |                         JournalSourcePos f (l1,_) -> (Just (l1, Nothing),f)  | ||||||
|         AppEvent (DateChange old _) | isStandardPeriod p && p `periodContainsDate` old -> |         AppEvent (DateChange old _) | isStandardPeriod p && p `periodContainsDate` old -> | ||||||
|           continue $ regenerateScreens j d $ setReportPeriod (DayPeriod d) ui |           continue $ regenerateScreens j d $ setReportPeriod (DayPeriod d) ui | ||||||
|           where |           where | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user