summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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