rewrite-inspector-0.1.0.9: Inspection of rewriting steps

Copyright(C) 2019 QBayLogic
LicenseBSD2 (see the file LICENSE)
MaintainerOrestis Melkonian <melkon.or@gmail.com>
Safe HaskellNone
LanguageHaskell2010

Pretty

Contents

Description

Pretty-printing utilities and styling for the TUI.

Synopsis

Rendering.

countOcc Source #

Arguments

:: Diff term 
=> Options term

options for Clash's pretty-printer

-> String

the string to search for

-> term

code to search in

-> Int

total number of occurrences

Count number of occurrences of a given search string in a given expression.

showCode Source #

Arguments

:: Diff term 
=> Bool

whether to scroll to focused region

-> Int

maximum line width

-> Options term

options for Clash's pretty-printer

-> [Ctx term]

the current context

-> String

the string to search for

-> term

code to display

-> Widget Name

the Brick widget to display

Render the given expression as a Widget.

data MyDoc Source #

A simpler document type, specific to our use-case.

Constructors

MString String 
MLine Int 
MMod [String] MyDoc 

data Item Source #

Constructors

Stx 
Ctx 

myForm :: forall term. Diff term => [Ctx term] -> SimpleDocStream (Ann term) -> [MyDoc] Source #

Convert a document stream into our simpler data type.

split :: [MyDoc] -> [(Int, [MyDoc])] Source #

Split into individual lines (of some indendation).

render :: Bool -> String -> Int -> (Int, [MyDoc]) -> Widget Name Source #

Render a single line in Brick (highlighting when marked).

Styling.

defaultTheme :: [(String, Attr)] -> Theme Source #

The default theme.

modify :: Bool -> [String] -> Widget n -> Widget n Source #

Add a list of stylistic modifications to a Widget.

highlightSearch Source #

Arguments

:: Int

occurrences so far

-> String

the whole string (haystack)

-> String

the string to search for (needle)

-> (Widget Name, Int) 

Highlight searched occurrences inside the given Widget.

emph :: String -> Widget n Source #

Styling for emphasized strings.

title :: String -> Widget n Source #

Styling for titles.

withBorder :: String -> Widget n -> Widget n Source #

Render a given widget inside a box with unicode border.

withBorderSelected :: String -> Widget n -> Widget n Source #

Render a given widget inside a box with unicode and bold border.

withBorderStyle :: BorderStyle -> String -> Widget n -> Widget n Source #

Render given Widget inside a box with the given title and border style.

fillSize :: Int -> String -> String Source #

Fill requested word size with spaces (if necessary).

vBoxSpaced :: [Widget n] -> Widget n Source #

A variant of vBox that adds spaces in-between.

hBoxSpaced :: Int -> [Widget n] -> Widget n Source #

A variant of hBox that adds spaces in-between.