vgrep-0.1.4.1: A pager for grep

Safe HaskellNone
LanguageHaskell2010

Vgrep.Widget.Pager

Contents

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).

  • Default keybindings

    ←↓↑→, hjkl    hScroll (-1), scroll 1, scroll (-1), hScroll 1
    PgUp, PgDn    scrollPage (-1), scrollPage 1
    

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

Eq Pager Source # 

Methods

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

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

Show Pager Source # 

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

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)

-> [Int]

List of line numbers that should be highlighted

-> VgrepT Pager m () 

Replace the currently displayed text.