summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authortv <tv@shackspace.de>2014-08-01 14:30:15 +0200
committertv <tv@shackspace.de>2014-08-01 14:30:15 +0200
commit7a4f697f7bdce5ab0f2d2dd62ace652056cfc1be (patch)
tree3ca8981030c2d5bde8720e47188c69a820c95d6c /src
parente77e6af554f73dc6010d2b79cf5b5a0fd740cb98 (diff)
display count in mode-info-box
Diffstat (limited to 'src')
-rw-r--r--src/Main.hs22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/Main.hs b/src/Main.hs
index 061b982..328c641 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -68,7 +68,7 @@ main = do
withMVar lockRef $ \ _ -> do
clearLine
a
- renderInputLine (mode q) (buffer q)
+ renderInputLine (count q) (mode q) (buffer q)
hFlush stdout
let cf = VTConfig
@@ -362,13 +362,25 @@ special colorCode s = "\x1b[1;" ++ show colorCode ++ "m" ++ s ++ "\x1b[m"
-- XXX assumes that the cursor is already at the (cleared) input line
-renderInputLine :: Mode -> Buffer -> IO ()
-renderInputLine m (lhs, rhs) = do
+-- TODO renderInputLine looks like it wants to be -> VT ()
+renderInputLine :: Maybe Int -> Mode -> Buffer -> IO ()
+renderInputLine mb_cnt m (lhs, rhs) = do
clearLine -- TODO this is required for drawing the mode on the right side
saveCursor
moveCursorRight 1024
- moveCursorLeft (length (show m) - 1)
- putStr $ "\x1b[1;30m" ++ show m ++ "\x1b[m"
+ let (infoLen, info) =
+ case mb_cnt of
+ Nothing ->
+ let gaudy = "\x1b[1;30m" ++ show m ++ "\x1b[m"
+ plain = show m
+ in (length plain, gaudy)
+ Just cnt ->
+ let gaudy = "\x1b[1;30m" ++ show m ++
+ "[\x1b[33m" ++ show cnt ++ "\x1b[30m]\x1b[m"
+ plain = show m ++ "[" ++ show cnt ++ "]"
+ in (length plain, gaudy)
+ moveCursorLeft $ infoLen - 1
+ putStr info
unsaveCursor
let promptString = case m of