mirror of
https://github.com/chrisdone/duet.git
synced 2025-01-08 06:53:22 +03:00
Delete a 1-case alt deletes the case
This commit is contained in:
parent
f7f314577e
commit
7b64bec27e
@ -287,10 +287,16 @@ interpretBackspace cursor ast = do
|
||||
pure w
|
||||
CaseExpression l e alts
|
||||
| any predicate alts -> do
|
||||
case alts of
|
||||
[] -> focusNode (expressionLabel e)
|
||||
(CaseAlt _ _ x:_) -> focusNode (expressionLabel x)
|
||||
pure (CaseExpression l e alts')
|
||||
if length alts == 1
|
||||
then do
|
||||
w <- liftIO newExpression
|
||||
focusNode (expressionLabel w)
|
||||
pure w
|
||||
else do
|
||||
case alts of
|
||||
[] -> focusNode (expressionLabel e)
|
||||
(CaseAlt _ _ x:_) -> focusNode (expressionLabel x)
|
||||
pure (CaseExpression l e alts')
|
||||
where alts' = filter (not . predicate) alts
|
||||
predicate =
|
||||
((||) <$>
|
||||
|
Loading…
Reference in New Issue
Block a user