Replace crashes with popups
This commit is contained in:
parent
c7f67945d8
commit
c557b89e46
2 changed files with 12 additions and 4 deletions
|
|
@ -113,7 +113,7 @@ actionEditNew s = do
|
|||
actionEditSelected :: Action
|
||||
actionEditSelected s =
|
||||
case selectedTask (tasks s) of
|
||||
Nothing -> error "no task selected" -- TODO: Add popup notification
|
||||
Nothing -> pure s
|
||||
Just t ->
|
||||
let edit = taskEdit RTaskEdit t ExistingTask
|
||||
in pure s{editor=Just edit}
|
||||
|
|
@ -194,7 +194,12 @@ actionFinishEdit t = pure . finishEdit t
|
|||
finishEdit :: TaskEdit RName -> UIState -> UIState
|
||||
finishEdit edit s =
|
||||
case editedTask edit of
|
||||
Left e -> error e -- TODO: Error popup
|
||||
Left e ->
|
||||
let p = popup "Syntax error" e
|
||||
[ ("Continue editing", B.continue)
|
||||
, ("Abort", \s' -> B.continue s'{editor=Nothing})
|
||||
]
|
||||
in s{errorPopup=Just p}
|
||||
Right task -> s{tasks=modify task, editor=Nothing}
|
||||
where
|
||||
modify :: Task -> TaskList RName
|
||||
|
|
|
|||
7
todo.txt
7
todo.txt
|
|
@ -1,4 +1,4 @@
|
|||
- c2018-09-18 Clean up file (adding creation/completion dates)
|
||||
x2018-10-23 c2018-09-18 Clean up file (adding creation/completion dates)
|
||||
- c2018-09-18 Purge - move completed tasks to a separate file
|
||||
x2018-10-23 c2018-09-28 Move cursor to beginning of task description when editing tasks
|
||||
- c2018-09-28 Syntax highlighting while editing tasks
|
||||
|
|
@ -9,4 +9,7 @@ x2018-09-30 c2018-09-18 Offer "retry" or "quit" +dialogue - couldn't load from t
|
|||
x2018-09-30 c2018-09-18 Offer "retry" or "quit" +dialogue - couldn't save to todo file
|
||||
x2018-09-30 c2018-09-18 Offer "retry" or "quit" +dialogue - syntax error in todo file
|
||||
x2018-09-30 c2018-09-30 Custom exception messages
|
||||
- c2018-10-23 Don't crash on parse errors etc.
|
||||
x2018-10-24 c2018-10-23 Don't crash on parse errors etc.
|
||||
- c2018-10-24 Add "u" - undo and "z" - redo buttons
|
||||
- c2018-10-24 Redo coloring - maybe black-on-white color scheme in-editor?
|
||||
- c2018-10-24 Reverse ordering of completed tasks - most recent at the top
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue