term::interact::pager(3tcl)

πŸ“¦
version 2.0 Β· 2 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– term::interact::pager πŸ’–

okay bestie, so this is a page from the Tcllib docs, living in the Terminal control section of the manual, and it's all about term::interact::pager β€” a whole lil terminal widget that pages text for you. let's get into it 🫢


✨ NAME ✨

term::interact::pager β€” it's a terminal widget, and it pages. that's the whole vibe. πŸ“„


✨ 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 for making a simple paging text display. that's it, that's the job. iconic, honestly. πŸ’…


✨ CLASS API ✨

the package exports exactly one command β€” the class command β€” and that's what lets you create pager instances. here's its API:

  • term::interact::pager object text ?options...? β€” this creates a brand new pager object named object, initializes it, and returns the fully qualified name of the object command as its result. the argument is the text to show, and after that you can optionally drop configuration options and their values. those options are explained down in the Configuration section, bestie. πŸ‘‘

✨ OBJECT API ✨

the objects that the class command creates give you all these methods:

  • object interact β€” shows the pager on screen at the configured location and starts interacting with it. heads up: this opens its own event loop for processing incoming characters, so it's giving main character energy. the method returns once the interaction has completed. go check the Interaction section for what can actually happen. πŸ¦‹
  • object done β€” a method for user supplied actions to terminate the interaction with the object. bye bestie πŸ‘‹
  • object clear β€” a method for user supplied actions to remove the pager from the terminal. poof, gone, no trace πŸ’¨
  • object text text β€” use this to change the text shown by the pager. and yes, the pager will reset the dispay to show the first line of the text at the top. (that spelling is literally in the original, don't come for me 😭)
  • object configure
  • object configure option
  • object configure option value...
  • object cget option β€” standard methods to retrieve and configure the options of the pager. the usual suspects, periodt. ✨

✨ CONFIGURATION ✨

a pager instance recognizes these options, no cap:

  • -in chan β€” specifies the channel to read character sequences from. defaults to stdin.
  • -out chan β€” specifies the channel to write the pager contents to. defaults to stdout.
  • -column int β€” specifies the column of the terminal where the left margin of the pager display should appear. defaults to 0, i.e. the left-most column.
  • -line int β€” specifies the line of the terminal where the top margin of the pager display should appear. defaults to 0, i.e. the top-most line.
  • -height int β€” specifies the number of lines of text to show at most in the display. defaults to 25.
  • -actions dict β€” specifies a dictionary containing additional actions, using character sequences as keys. ⚠️ note that these sequences cannot override the hardwired sequences described in the Interaction section. the defaults stay undefeated, fr fr. πŸ’€

✨ INTERACTION ✨

a pager object recognizes the control sequences below and acts as described. you can supply more control sequences to act on via the configuration, but you are not able to overide these defaults. (again, that spelling is the original's, love her πŸ’œ)

  • Cursor Up β€” the text is scrolled down a single line, making one more line visible at the top. the pager will not react if the first line of the text is already shown. ⬆️
  • Cursor Down β€” the text is scrolled up a single line, making one more line visible at the bottom. the pager will not react if the last line of the text is already shown. ⬇️
  • Page Up β€” the text is scrolled down a page. the pager will not react if the first line of the text is already shown. πŸ“ƒ
  • Page Down β€” the text is scrolled up a page. the pager will not react if the last line of the text is already shown. πŸ“ƒ
  • Enter/Return β€” the interaction with the object is terminated. that's the exit, slay. πŸŽ€

✨ BUGS, IDEAS, FEEDBACK ✨

ngl, this document and the package it describes will undoubtedly contain bugs and other problems. 😭 please report those in the category term of the Tcllib Trackers: http://core.tcl.tk/tcllib/reportlist. and please also report any ideas for enhancements you may have for either the package and/or the documentation β€” we want all of it, bestie. πŸ’–

when proposing code changes, please provide unified diffs, i.e. the output of diff -u.

also note further that attachments are strongly preferred over inlined patches. attachments can be made by going to the Edit form of the ticket immediately after its creation, and then using the left-most button in the secondary navigation bar. do it that way, trust. ✨


✨ KEYWORDS ✨

control, pager, terminal, text display 🌸


✨ CATEGORY ✨

Terminal control πŸ–₯️


Copyright (c) 2006 Andreas Kupries <andreas_kupries@users.sourceforge.net>


and that's the whole page, babe 🫢 this was tcllib, version 0.2, and it's the term::interact::pager(3tcl) manpage β€” go page some text and have the best day, mwah πŸ’‹βœ¨πŸŒˆ

πŸ“¦ where this page comes from