Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- pagerWidget :: PagerWidget
- type PagerWidget = Widget Pager
- data Pager
- moveToLine :: Monad m => Int -> VgrepT Pager m Redraw
- scroll :: Monad m => Int -> VgrepT Pager m Redraw
- scrollPage :: Monad m => Int -> VgrepT Pager m Redraw
- scrollPageFraction :: Monad m => Rational -> VgrepT Pager m Redraw
- hScroll :: Monad m => Int -> VgrepT Pager m Redraw
- replaceBufferContents :: Monad m => Seq Text -> IntMap AnsiFormatted -> VgrepT Pager m ()
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
andlineNumbersHl
(default: bold).
type PagerWidget = Widget Pager Source #
Internal state
Keeps track of the lines of text to display, the current scroll positions, and the set of highlighted line numbers.
Widget actions
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 #
:: 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.