Script Library: 1219 scripts
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 
View scriptLicenseDownload documentation as: HTML or editable
Download scriptHistoryOther scripts by: btiffin

Documentation for: pager.r


Usage document for %pager.r

1. Introduction to the REBOL more less pager

This library script is for supporting REBOL console development and capturing output for perusal.

2. pager At a Glance

Note; more, less, page, and pager are all defined

 >> more system
 >> more %myfile.r
 >> more/num/cap [repeat i 100 [print ["Radius" i "Area:" i * i * pi] ] ]
 

3. Using %pager.r

Including this tool is simple. Just DO it.

 >>do %pager.r
 

or to execute this right out of the rebol.org library

 >>do http://www.rebol.org/cgi-bin/cgiwrap/rebol/download-a-script.r?script-name=pager.r
 

3.1. Application keys

q Quit out
b Back a page
Enter, down arrow Advance one line
Backspace, Up arrow Back one line
digit '1' to '9' Advance n lines
> To bottom
< To top
/ Find forward
? Find reverse
g Goto line
n Find next forward
p Find previous backwards
w weefresh screen
h help and info

3.2. Options

num: logic! on or off for display of (source file) line numbers
eof: logic! true waits at end of file
rows: integer! The console is queried for this, but it can be overridden
cols: integer! Override the value the console reports

3.3. Help

 >> help pager
 USAGE:
     PAGER intake /options electives /cap /n /num

 DESCRIPTION:
      supports b, <, >, w, /, ?, q while paging
      PAGER is a function value.

 ARGUMENTS:
      intake -- input data or filename (Type: any)

 REFINEMENTS:
      /options -- rows: cols: integer!, eof: num: logic!
          electives -- (Type: block)
      /cap -- input becomes block to evaluate and capture prin/t]
      /num -- shortcut (and override) for /options [num: on]
 

4. Some advanced 'features'

  • Using Next or Previous without a search string will scan for none
  • newlines are inserted at terminal columns sizes. Search will miss strings that span these newlines
  • you probably don't want to more/cap [more/cap ...]
  • The GC may not get a chance to optimally do its thing due to references
  • The author uses more, less, page, and pager. All these words are defined for the same function. Feel free to drop the names you don't use.

5. Credits

%pager.r Original author: Brian Tiffin
  • The rebol.org Library Team
  • Usage document by Brian Tiffin, Library Team, Last updated: 1-Mar-2008