ghcup-0.1.50.0: ghc toolchain installer
Safe HaskellSafe-Inferred
LanguageHaskell2010

GHCup.Utils.Output

Synopsis

Documentation

fitsInTerminal :: [Text] -> IO (Maybe Bool) Source #

Checks whether the given text lines fit in the terminal window. Returns Nothing if the terminal size could not be determined (e.g. bc we're part of a pipe).

fitsInTerminal' :: Text -> IO (Maybe Bool) Source #

Like fitsInTerminal, but takes a single text blob.

strWidth :: String -> Int Source #

Calculate the render width of a string, considering wide characters (counted as double width), ANSI escape codes (not counted), and line breaks (in a multi-line string, the longest line determines the width).

stripAnsi :: String -> String Source #

Strip ANSI escape sequences from a string.

>>> stripAnsi "\ESC[31m-1\ESC[m"
"-1"

charWidth :: Char -> Int Source #

Get the designated render width of a character: 0 for a combining character, 1 for a regular character, 2 for a wide character. (Wide characters are rendered as exactly double width in apps and fonts that support it.) (From Pandoc.)