term::interact::pager(n)
β¨ term::interact::pager(n) β¨
okay so bestie, welcome to term::interact::pager, a page from the Terminal control manual, and it's literally the cutest little terminal widget for paging text π (also the man page name is term::interact::pager(n) in case you were wondering, and now you know, iykyk π)
πΈ NAME πΈ
term::interact::pager β Terminal widget, paging. yeah. that's it. a widget. that pages. slay.
β¨ SYNOPSIS β¨
package require Tcl 8.5 9
package require term::interact::pager ?0.2?
term::interact::pager object text ?options...?
object interact
object done
object clear
object text text
object configure
object configure option
object configure option value...
object cget option
π DESCRIPTION π
So this package hands you a class that makes a simple paging text display. That's the whole vibe. Simple. Paging. Text. Display. Periodt.
π CLASS API π
The package exports exactly one command β the class command β and that's what lets you birth pager instances into existence π¦ its API goes like this:
term::interact::pager object text ?options...?β this command makes a brand new pager object named object, initializes it, and hands you back the fully qualified name of the object command as its result. the argument is the text to show, and then optionally you can tack on configuration options and their values. all those options get explained down in the Configuration section, keep scrolling bestie π
π«Ά OBJECT API π«Ά
The objects that the class command creates give you these methods, no more, no less:
object interactβ shows the pager on the screen at whatever location you configured, and starts interacting with it. heads up: this opens its own event loop for processing incoming characters π³ the method returns once the interaction is done. for what interaction actually means, see the Interaction section below.object doneβ a method for user supplied actions to call when they want to terminate the interaction with the object.object clearβ a method for user supplied actions to call when they want to remove the pager from the terminal.object text textβ use this to change the text the pager is showing. and it will reset the display so the first line of the text sits right at the top. fresh start energy β¨object configureobject configure optionobject configure option value...object cget optionβ these last four are just the standard methods for retrieving and configuring the pager's options. you know them, you love them π
π CONFIGURATION π
A pager instance recognizes these options, and only these, bestie:
-in chanβ the channel to read character sequences from. defaults tostdin.-out chanβ the channel to write the pager contents to. defaults tostdout.-column intβ the column of the terminal where the left margin of the pager display should show up. defaults to0, aka the left-most column.-line intβ the line of the terminal where the top margin of the pager display should show up. defaults to0, aka the top-most line.-height intβ how many lines of text to show at most in the display. defaults to25.-actions dictβ a dictionary of extra actions, keyed by character sequences. β οΈ note that these sequences cannot override the hardwired sequences described in the Interaction section. the defaults are the defaults, no cap.
π INTERACTION π
A pager object recognizes the control sequences below and does exactly what it says. you can feed it more control sequences to act on via configuration, but you are not able to override these defaults π ββοΈ
- Cursor Up β the text scrolls down one single line, which makes one more line visible at the top. the pager just won't react if the first line of the text is already showing.
- Cursor Down β the text scrolls up one single line, making one more line visible at the bottom. the pager won't react if the last line of the text is already showing.
- Page Up β the text scrolls down a whole page. and yeah, the pager won't react if the first line of the text is already showing.
- Page Down β the text scrolls up a whole page. the pager won't react if the last line of the text is already showing.
- Enter/Return β the interaction with the object is terminated. bye bestie π
π BUGS, IDEAS, FEEDBACK π
ngl, this document and the package it describes will undoubtedly contain bugs and other problems. please report them in the category term of the Tcllib Trackers at [http://core.tcl.tk/tcllib/reportlist](http://core.tcl.tk/tcllib/reportlist). and while you're there, please also report any ideas for enhancements you have for either the package and/or the documentation π«Ά
When proposing code changes, please provide unified diffs, i.e. the output of diff -u.
Also note: attachments are strongly preferred over inlined patches. you can attach stuff by going to the Edit form of the ticket right after you create it, then using the left-most button in the secondary navigation bar. that's the move π
β KEYWORDS β
control, pager, terminal, text display
π¦ CATEGORY π¦
Terminal control
π COPYRIGHT π
Copyright (c) 2006 Andreas Kupries <andreas_kupries@users.sourceforge.net>
okay that's the whole page, you're officially a pager expert now, main character energy fr fr πβ¨ and for the sign-off: this was tcllib version 0.2, from the term::interact::pager(n) page β love u, go page some text π π
π¦ where this page comes from
- fedora 43: tcllib 2.0-3.fc43 Β· TCL
- fedora 44: tcllib 2.0-4.fc44 Β· TCL
- nixos 26.05: tcllib 2.0
- nixpkgs unstable: tcllib 2.0
- Copyright (c) 2006 Andreas Kupries <andreas_kupries@users\&.sourceforge\&.net>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms