summaryrefslogtreecommitdiff
path: root/Pancake/Command.hs
diff options
context:
space:
mode:
authordefanor <defanor@uberspace.net>2017-12-21 09:23:21 +0300
committerdefanor <defanor@uberspace.net>2017-12-21 09:23:21 +0300
commitb32900a7d426f06ee1bd2f69d8cf7899034f5470 (patch)
tree33496f0d50e87b286da038973cb294079da3dafc /Pancake/Command.hs
parentdbd5740dea0ad6119cbef2b3b1cccf1e865beaca (diff)
Retain position on redisplay, reload, etc
Based on line numbers that are attached to document blocks, not dependent on window/terminal width. Some bits can still be refined/refactored, but here's the initial support.
Diffstat (limited to 'Pancake/Command.hs')
-rw-r--r--Pancake/Command.hs8
1 files changed, 8 insertions, 0 deletions
diff --git a/Pancake/Command.hs b/Pancake/Command.hs
index 52ace06..1fd7074 100644
--- a/Pancake/Command.hs
+++ b/Pancake/Command.hs
@@ -61,6 +61,7 @@ data Command = Quit
| Shortcut String String
| LoadConfig (Maybe FilePath)
| SetWidth (Maybe Int)
+ | SetPos (Maybe Int)
| Redisplay
deriving (Show, Eq)
@@ -153,6 +154,12 @@ setWidth = string "set width"
*> (SetWidth <$> optionMaybe (space *> pNat))
<* eof
+-- | 'SetPos' command parser.
+setPos :: Parser Command
+setPos = string "set position"
+ *> (SetPos <$> optionMaybe (space *> pNat))
+ <* eof
+
-- | 'LoadConfig' command parser.
loadConf :: Parser Command
loadConf = string "load config"
@@ -171,6 +178,7 @@ command c =
, saveCurrent <?> "save current"
, save <?> "save"
, setWidth <?> "set width"
+ , setPos <?> "set position"
, loadConf <?> "load config"
, goTo <?> "follow uri"
])