X.P.OrgMode: Prune extra whitespace

This implements whitespace pruning at the end of a sheduled item or
deadline.  If we have a message like

    This is a message                +s today

it is expected that we created a heading of just "This is a message",
without the extra whitespace.
This commit is contained in:
slotThe
2021-06-10 15:43:27 +02:00
parent c89730fc32
commit 5da9b26142

View File

@@ -324,8 +324,10 @@ pInput inp = fmap fst . listToMaybe . (`readP_to_S` inp) . lchoice $
next <- munch1 (/= head ptn)
next' <- munch1 (/= ' ')
if next' == ptn
then pure $ consumed <> next
else go $ consumed <> next <> next'
then -- If we're done, it's time to prune extra whitespace
pure $ consumed <> dropWhileEnd (== ' ') next
else -- If not, keep it as it's part of something else
go $ consumed <> next <> next'
-- | Try to parse a 'Time'.
pTimeOfDay :: ReadP (Maybe TimeOfDay)