term::ansi::code::ctrl(n)
β¨ term::ansi::code::ctrl β the manual, part 1 β¨
okay bestie, buckle up π this is term::ansi::code::ctrl, a manual page from the Terminal control section (that's the (n) part, iykyk). we're doing this in parts because it's LONG, and this is part one. grab a snack. π
πΈ NAME πΈ
term::ansi::code::ctrl β ANSI control sequences. that's it, that's the whole vibe. control sequences, babes β¨
π SYNOPSIS π
first things first, the requirements. you gotta have these or nothing works, fr fr:
package require Tcl 8.5 9
package require term::ansi::code ?0.2?
package require term::ansi::code::ctrl ?0.3?
and now the star of the show β every single command this package gives you. all of them. no skipping, we're doing the whole list π :
::term::ansi::code::ctrl::names
::term::ansi::code::ctrl::import ?ns? ?arg...?
::term::ansi::code::ctrl::eeol
::term::ansi::code::ctrl::esol
::term::ansi::code::ctrl::el
::term::ansi::code::ctrl::ed
::term::ansi::code::ctrl::eu
::term::ansi::code::ctrl::es
::term::ansi::code::ctrl::sd
::term::ansi::code::ctrl::su
::term::ansi::code::ctrl::ch
::term::ansi::code::ctrl::sc
::term::ansi::code::ctrl::rc
::term::ansi::code::ctrl::sca
::term::ansi::code::ctrl::rca
::term::ansi::code::ctrl::st
::term::ansi::code::ctrl::ct
::term::ansi::code::ctrl::cat
::term::ansi::code::ctrl::qdc
::term::ansi::code::ctrl::qds
::term::ansi::code::ctrl::qcp
::term::ansi::code::ctrl::rd
::term::ansi::code::ctrl::elw
::term::ansi::code::ctrl::dlw
::term::ansi::code::ctrl::eg
::term::ansi::code::ctrl::lg
::term::ansi::code::ctrl::scs0 tag
::term::ansi::code::ctrl::scs1 tag
::term::ansi::code::ctrl::sda arg...
::term::ansi::code::ctrl::sda_fgblack
::term::ansi::code::ctrl::sda_fgred
::term::ansi::code::ctrl::sda_fggreen
::term::ansi::code::ctrl::sda_fgyellow
::term::ansi::code::ctrl::sda_fgblue
::term::ansi::code::ctrl::sda_fgmagenta
::term::ansi::code::ctrl::sda_fgcyan
::term::ansi::code::ctrl::sda_fgwhite
::term::ansi::code::ctrl::sda_fgdefault
::term::ansi::code::ctrl::sda_bgblack
::term::ansi::code::ctrl::sda_bgred
::term::ansi::code::ctrl::sda_bggreen
::term::ansi::code::ctrl::sda_bgyellow
::term::ansi::code::ctrl::sda_bgblue
::term::ansi::code::ctrl::sda_bgmagenta
::term::ansi::code::ctrl::sda_bgcyan
::term::ansi::code::ctrl::sda_bgwhite
::term::ansi::code::ctrl::sda_bgdefault
::term::ansi::code::ctrl::sda_bold
::term::ansi::code::ctrl::sda_dim
::term::ansi::code::ctrl::sda_italic
::term::ansi::code::ctrl::sda_underline
::term::ansi::code::ctrl::sda_blink
::term::ansi::code::ctrl::sda_revers
::term::ansi::code::ctrl::sda_hidden
::term::ansi::code::ctrl::sda_strike
::term::ansi::code::ctrl::sda_nobold
::term::ansi::code::ctrl::sda_noitalic
::term::ansi::code::ctrl::sda_nounderline
::term::ansi::code::ctrl::sda_noblink
::term::ansi::code::ctrl::sda_norevers
::term::ansi::code::ctrl::sda_nohidden
::term::ansi::code::ctrl::sda_nostrike
::term::ansi::code::ctrl::sda_reset
::term::ansi::send::fcp row col
::term::ansi::code::ctrl::cu ?n?
::term::ansi::code::ctrl::cd ?n?
::term::ansi::code::ctrl::cf ?n?
::term::ansi::code::ctrl::cb ?n?
::term::ansi::code::ctrl::ss ?s e?
::term::ansi::code::ctrl::skd code str
::term::ansi::code::ctrl::title str
::term::ansi::code::ctrl::gron
::term::ansi::code::ctrl::groff
::term::ansi::code::ctrl::tlc
::term::ansi::code::ctrl::trc
::term::ansi::code::ctrl::brc
::term::ansi::code::ctrl::blc
::term::ansi::code::ctrl::ltj
::term::ansi::code::ctrl::ttj
::term::ansi::code::ctrl::rtj
::term::ansi::code::ctrl::btj
::term::ansi::code::ctrl::fwj
::term::ansi::code::ctrl::hl
::term::ansi::code::ctrl::vl
::term::ansi::code::ctrl::groptim str
::term::ansi::code::ctrl::clear
::term::ansi::code::ctrl::init
::term::ansi::code::ctrl::showat row col text
also lowkey clock that one::term::ansi::send::fcp row colsitting in the middle of all thectrlcommands. yeah. it's there. not a typo on my part, bestie, it's literally what the page says. π
π DESCRIPTION π
okay so here's the whole concept, and it's actually so clean:
this package is basically a glossary of symbolic names for the ANSI control sequences. instead of you out here memorizing escape codes like some kind of wizard (respect, but no), you get a nice little named command for each sequence.
and every one of those commands does exactly one thing: it returns the sequence as its result. that's the whole job. β¨
now the important part, and I need you to hear me on this one:
NONE of the commands in this package write to a channel. not one. zero. nada.
they just hand you the sequence back and that's it. actually sending it somewhere? that's a job for the higher level packages, like term::ansi::send. this package is the dictionary, that one's the mail carrier. π
that's part one, bestie β the names, the requirements, the whole command lineup, and the vibe. part two is coming with all the individual commands and what each one does, so don't go anywhere π¦β¨
π¦ API π¦
π INTROSPECTION π
::term::ansi::code::ctrl::namesβ the lil' peeking-into-the-toybox command π It hands you back a list with the names of all the attribute commands, so you can see what you're working with. No cap.::term::ansi::code::ctrl::import ?ns? ?arg...?β this one moves some (or all) of the attribute commands into the namespace ns. By default that namespace isctrl. Heads up bestie: ns is a relative namespace name, so the imported commands land in a child of the namespace you're currently in. By default every command gets imported, but you can restrict it β just list the names of the commands you actually want after the namespace argument. π«Ά
β¨ SEQUENCES β¨
okay so here's the whole menu of control sequences, each one its own lil' command. slay. π
::term::ansi::code::ctrl::eeolβ Erase (to) End Of Line::term::ansi::code::ctrl::esolβ Erase (to) Start Of Line::term::ansi::code::ctrl::elβ Erase (current) Line::term::ansi::code::ctrl::edβ Erase Down (to bottom)::term::ansi::code::ctrl::euβ Erase Up (to top)::term::ansi::code::ctrl::esβ Erase Screen::term::ansi::code::ctrl::sdβ Scroll Down::term::ansi::code::ctrl::suβ Scroll Up::term::ansi::code::ctrl::chβ Cursor Home π::term::ansi::code::ctrl::scβ Save Cursor::term::ansi::code::ctrl::rcβ Restore Cursor (Unsave)::term::ansi::code::ctrl::scaβ Save Cursor + Attributes::term::ansi::code::ctrl::rcaβ Restore Cursor + Attributes::term::ansi::code::ctrl::stβ Set Tab (@ current position)::term::ansi::code::ctrl::ctβ Clear Tab (@ current position)::term::ansi::code::ctrl::catβ Clear All Tabs::term::ansi::code::ctrl::qdcβ Query Device Code::term::ansi::code::ctrl::qdsβ Query Device Status::term::ansi::code::ctrl::qcpβ Query Cursor Position::term::ansi::code::ctrl::rdβ Reset Device::term::ansi::code::ctrl::elwβ Enable Line Wrap::term::ansi::code::ctrl::dlwβ Disable Line Wrap::term::ansi::code::ctrl::egβ Enter Graphics Mode::term::ansi::code::ctrl::lgβ Exit Graphics Mode::term::ansi::code::ctrl::scs0 tagβ Set default character set::term::ansi::code::ctrl::scs1 tagβ Set alternate character set Select Character Set.
okay so this is the character-set-picker. Choose which character set gets used for either the default font (scs0) or the alternate font (scs1). And no, this does not change whether the default or alternate font is being used β it only changes their definition. subtle but iconic. π
The legal tags, and what they mean, are:
Aβ United Kingdom SetBβ ASCII Set0β Special Graphics1β Alternate Character ROM Standard Character Set2β Alternate Character ROM Special Graphics
::term::ansi::code::ctrl::sda arg...β Set Display Attributes. The arguments are the code sequences for the possible attributes, as provided by the packageterm::ansi::code::attr. And for convenience, this package also gives you a bunch of extra commands, each one setting a single specific attribute. (they're all right below, go look π)
π¨ the single-attribute glow-up commands π¨
::term::ansi::code::ctrl::sda_fgblackβ Set text color to Black.::term::ansi::code::ctrl::sda_fgredβ Set text color to Red.::term::ansi::code::ctrl::sda_fggreenβ Set text color to Green.::term::ansi::code::ctrl::sda_fgyellowβ Set text color to Yellow.::term::ansi::code::ctrl::sda_fgblueβ Set text color to Blue.::term::ansi::code::ctrl::sda_fgmagentaβ Set text color to Magenta.::term::ansi::code::ctrl::sda_fgcyanβ Set text color to Cyan.::term::ansi::code::ctrl::sda_fgwhiteβ Set text color to White.::term::ansi::code::ctrl::sda_fgdefaultβ Set default text color (Black).::term::ansi::code::ctrl::sda_bgblackβ Set background to Black.::term::ansi::code::ctrl::sda_bgredβ Set background to Red.::term::ansi::code::ctrl::sda_bggreenβ Set background to Green.::term::ansi::code::ctrl::sda_bgyellowβ Set background to Yellow.::term::ansi::code::ctrl::sda_bgblueβ Set background to Blue.::term::ansi::code::ctrl::sda_bgmagentaβ Set background to Magenta.::term::ansi::code::ctrl::sda_bgcyanβ Set background to Cyan.::term::ansi::code::ctrl::sda_bgwhiteβ Set background to White.::term::ansi::code::ctrl::sda_bgdefaultβ Set default background (Transparent).::term::ansi::code::ctrl::sda_boldβ Bold on.::term::ansi::code::ctrl::sda_dimβ Dim on.::term::ansi::code::ctrl::sda_italicβ Italics on.::term::ansi::code::ctrl::sda_underlineβ Underscore on.::term::ansi::code::ctrl::sda_blinkβ Blink on. (go little light go β¨)::term::ansi::code::ctrl::sda_reversβ Reverse on.::term::ansi::code::ctrl::sda_hiddenβ Hidden on. (ninja mode π₯·)::term::ansi::code::ctrl::sda_strikeβ Strike-through on.::term::ansi::code::ctrl::sda_noboldβ Bold off.::term::ansi::code::ctrl::sda_noitalicβ Italics off.::term::ansi::code::ctrl::sda_nounderlineβ Underscore off.::term::ansi::code::ctrl::sda_noblinkβ Blink off.::term::ansi::code::ctrl::sda_noreversβ Reverse off.::term::ansi::code::ctrl::sda_nohiddenβ Hidden off.::term::ansi::code::ctrl::sda_nostrikeβ Strike-through off.::term::ansi::code::ctrl::sda_resetβ Reset all attributes to their default values. the factory reset of vibes π
π§ cursor + screen shenanigans π§
::term::ansi::send::fcp row colβ Force Cursor Position (aka Go To). yep, that's really the package name in there, we keep it exactly as written. π«Ά::term::ansi::code::ctrl::cu ?n?β Cursor Up. n defaults to1.::term::ansi::code::ctrl::cd ?n?β Cursor Down. n defaults to1.::term::ansi::code::ctrl::cf ?n?β Cursor Forward. n defaults to1.::term::ansi::code::ctrl::cb ?n?β Cursor Backward. n defaults to1.::term::ansi::code::ctrl::ss ?s e?β Scroll Screen (entire display, or between rows start and end, inclusive).::term::ansi::code::ctrl::skd code strβ Set Key Definition.::term::ansi::code::ctrl::title strβ Set the terminal title.::term::ansi::code::ctrl::gronβ Switch to character/box graphics. I.e. switch to the alternate font.::term::ansi::code::ctrl::groffβ Switch to regular characters. I.e. switch to the default font.
π¦ box-drawing character graphics π¦
these are the building blocks, bestie. make a whole lil' flowchart. π
::term::ansi::code::ctrl::tlcβ Character graphics, Top Left Corner.::term::ansi::code::ctrl::trcβ Character graphics, Top Right Corner.::term::ansi::code::ctrl::brcβ Character graphics, Bottom Right Corner.::term::ansi::code::ctrl::blcβ Character graphics, Bottom Left Corner.::term::ansi::code::ctrl::ltjβ Character graphics, Left T Junction.::term::ansi::code::ctrl::ttjβ Character graphics, Top T Junction.::term::ansi::code::ctrl::rtjβ Character graphics, Right T Junction.::term::ansi::code::ctrl::btjβ Character graphics, Bottom T Junction.::term::ansi::code::ctrl::fwjβ Character graphics, Four-Way Junction.::term::ansi::code::ctrl::hlβ Character graphics, Horizontal Line.::term::ansi::code::ctrl::vlβ Character graphics, Vertical Line.::term::ansi::code::ctrl::groptim strβ Optimize character graphics. The generator commands above create way too many superfluous commands shifting into and out of the graphics mode (not them being extra π). This command removes all the shifts which aren't needed. And to pull that off, it also knows which characters will look the same in both modes, so it can handle strings created outside of this package too. multi-talented fr fr.
π§Ό quality-of-life wrappers π§Ό
::term::ansi::code::ctrl::clearβ Clear screen. In essence a sequence of CursorHome + EraseDown.::term::ansi::code::ctrl::initβ Initialize default and alternate fonts to ASCII and box graphics.::term::ansi::code::ctrl::showat row col textβ Format the block of text for display at the specified location.
π BUGS, IDEAS, FEEDBACK π
This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category term of the Tcllib Trackers [http://core.tcl.tk/tcllib/reportlist](http://core.tcl.tk/tcllib/reportlist). Please also report any ideas for enhancements you may have for either the package and/or the documentation. we love feedback, periodt. π
When proposing code changes, please provide unified diffs, i.e the output of diff -u.
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. π
π KEYWORDS π
ansi, attribute control, color control, control, terminal
π CATEGORY π
Terminal control
Β©οΈ COPYRIGHT Β©οΈ
Copyright (c) 2006-2008 Andreas Kupries <andreas_kupries@users.sourceforge.net>
and that's the whole page bestie!! π«Ά this was term::ansi::code::ctrl(n) from tcllib, version 0.3, and the footer is signed off the way it always is β tcllib on the left, 0.3 sitting in the middle where the date normally lives, and the page name on the right. slay, go make your terminal pretty π
β¨π
π¦ 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-2008 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