vgrep-0.2.3.0: A pager for grep
Safe HaskellNone
LanguageHaskell2010

Vgrep.Widget.Pager

Synopsis

Pager widget

pagerWidget :: PagerWidget Source #

Display lines of text with line numbers

  • Initial state

    The pager is empty, i. e. no lines of text to display.

  • Drawing the pager

    The lines of text are printed, starting at the current scroll position. If not enough lines are available, the scroll position is adjusted until either the screen is filled, or the first line is reached. Highlighted lines are displayed according to the config values normalHl and lineNumbersHl (default: bold).

Internal state

data Pager Source #

Keeps track of the lines of text to display, the current scroll positions, and the set of highlighted line numbers.

Instances

Instances details
Eq Pager Source # 
Instance details

Defined in Vgrep.Widget.Pager.Internal

Methods

(==) :: Pager -> Pager -> Bool #

(/=) :: Pager -> Pager -> Bool #

Show Pager Source # 
Instance details

Defined in Vgrep.Widget.Pager.Internal

Methods

showsPrec :: Int -> Pager -> ShowS #

show :: Pager -> String #

showList :: [Pager] -> ShowS #

Widget actions

moveToLine :: Monad m => Int -> VgrepT Pager m Redraw Source #

Scroll to the given line number.

scroll :: Monad m => Int -> VgrepT Pager m Redraw Source #

Scroll up or down one line.

scroll (-1)  -- scroll one line up
scroll 1     -- scroll one line down

scrollPage :: Monad m => Int -> VgrepT Pager m Redraw Source #

Scroll up or down one page. The first line on the current screen will be the last line on the scrolled screen and vice versa.

scrollPage (-1)  -- scroll one page up
scrollPage 1     -- scroll one page down

scrollPageFraction :: Monad m => Rational -> VgrepT Pager m Redraw Source #

Scroll up or down a fraction of a page. For integers, 'scrollPageFraction n == scrollPage n'.

scrollPageFraction (-1%2)            -- scroll one half page up
scrollPageFraction (1%2)             -- scroll one half page down
scrollPageFraction (fromRational 1)  -- scroll one page down

hScroll :: Monad m => Int -> VgrepT Pager m Redraw Source #

Horizontal scrolling. Increment is one tabstop.

hScroll (-1)  -- scroll one tabstop left
hScroll 1     -- scroll one tabstop right

replaceBufferContents Source #

Arguments

:: Monad m 
=> Seq Text

Lines of text to display in the pager (starting with line 1)

-> IntMap AnsiFormatted

Line numbers and formatted text for highlighted lines

-> VgrepT Pager m () 

Replace the currently displayed text.