Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/Lib.hs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ respondToHelperFunction (HelperFunction sig) = setreg "\"" sig
respondToHelperFunction (Version ver) = reportInfo ver
respondToHelperFunction _ = pure ()

parenthesize :: Text -> Text
parenthesize t =
let trimmed = T.strip t
in if T.any (== ' ') trimmed && not (T.isPrefixOf "(" trimmed && T.isSuffixOf ")" trimmed)
then "(" <> trimmed <> ")"
else trimmed

respond :: Buffer -> Response -> Neovim CornelisEnv ()
-- Update the buffer's goal map
Expand Down Expand Up @@ -77,7 +83,7 @@ respond b (SolveAll solutions) = do
Nothing -> reportError $ T.pack $ "Can't find interaction point " <> show i
Just ip -> do
int <- getIpInterval b ip
replaceInterval b int $ replaceQuestion ex
replaceInterval b int $ parenthesize $ replaceQuestion ex
load
respond b ClearHighlighting = do
-- delete what we know about goto positions and stored extmarks
Expand Down