From b32900a7d426f06ee1bd2f69d8cf7899034f5470 Mon Sep 17 00:00:00 2001 From: defanor Date: Thu, 21 Dec 2017 09:23:21 +0300 Subject: 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. --- Pancake/Command.hs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'Pancake/Command.hs') 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" ]) -- cgit v1.2.3