mirror of
https://github.com/urbit/shrub.git
synced 2024-12-19 00:13:12 +03:00
kh: improve code style
Removes superfluous parens, makes better use of pattern matching, and respects project-wide capitalization style.
This commit is contained in:
parent
b3964c97a6
commit
addcf42468
@ -397,11 +397,8 @@ getSpinnerNameForEvent = \case
|
||||
BlipEvHttpServer _ -> Just "eyre"
|
||||
BlipEvNewt _ -> Just "newt"
|
||||
BlipEvSync _ -> Just "clay"
|
||||
BlipEvTerm t | isUser t -> Nothing
|
||||
BlipEvTerm (TermEvBelt _ _) -> Nothing
|
||||
BlipEvTerm t -> Just "term"
|
||||
where
|
||||
isUser (TermEvBelt _ _) = True
|
||||
isUser _ = False
|
||||
|
||||
summarizeEvent :: Ev -> Text
|
||||
summarizeEvent ev =
|
||||
|
@ -313,9 +313,9 @@ localClient doneSignal = fst <$> mkRAcquire start stop
|
||||
-- TODO: Ignoring priority for now. Priority changes the color of,
|
||||
-- and adds a prefix of '>' to, the output.
|
||||
let lines = fmap unTape $ wash (WashCfg 0 width) $ tankTree $ snd slog
|
||||
T.putCSI 'm' [90] --NOTE print slogs in grey
|
||||
T.putCsi 'm' [90] --NOTE print slogs in grey
|
||||
forM (intersperse "\n" lines) $ \line -> putStr line
|
||||
T.putCSI 'm' [0]
|
||||
T.putCsi 'm' [0]
|
||||
T.lojack
|
||||
pure ls
|
||||
|
||||
|
@ -92,7 +92,7 @@ step st@St{..} = \case
|
||||
st { sLine = "", sCurPos = (0, 0) }
|
||||
& recordText (sLine <> "\n")
|
||||
| otherwise ->
|
||||
st { sCurPos = (((fst sCurPos) - 1), 0) }
|
||||
st { sCurPos = (fst sCurPos - 1, 0) }
|
||||
where
|
||||
recordText :: Text -> St -> St
|
||||
recordText !t st@St{..} = st {
|
||||
|
@ -8,7 +8,7 @@ module Urbit.Vere.Term.Render
|
||||
, cursorMove
|
||||
, cursorSave
|
||||
, cursorRestore
|
||||
, putCSI
|
||||
, putCsi
|
||||
, hijack
|
||||
, lojack
|
||||
) where
|
||||
@ -39,19 +39,19 @@ cursorSave = liftIO ANSI.saveCursor
|
||||
cursorRestore :: MonadIO m => m ()
|
||||
cursorRestore = liftIO ANSI.restoreCursor
|
||||
|
||||
putCSI :: MonadIO m => Char -> [Int] -> m ()
|
||||
putCSI c a = liftIO do
|
||||
putCsi :: MonadIO m => Char -> [Int] -> m ()
|
||||
putCsi c a = liftIO do
|
||||
putStr "\x1b["
|
||||
putStr $ pack $ mconcat $ intersperse ";" (fmap show a)
|
||||
putStr $ pack [c]
|
||||
|
||||
hijack :: MonadIO m => Int -> m ()
|
||||
hijack h = liftIO do
|
||||
putCSI 'r' [1, h-1] -- set scroll region to exclude bottom line
|
||||
putCSI 'S' [1] -- scroll up one line
|
||||
putCsi 'r' [1, h-1] -- set scroll region to exclude bottom line
|
||||
putCsi 'S' [1] -- scroll up one line
|
||||
cursorMove (h-2) 0 -- move cursor to empty space
|
||||
|
||||
lojack :: MonadIO m => m ()
|
||||
lojack = liftIO do
|
||||
putCSI 'r' [] -- reset scroll region
|
||||
putCsi 'r' [] -- reset scroll region
|
||||
cursorRestore -- restory cursor position
|
||||
|
Loading…
Reference in New Issue
Block a user