term::ansi::send(n)
π term::ansi::send(n) β Terminal control π
okay bestie, come CLOSE. this is the manual page for term::ansi::send, which lives in the Terminal control section of the Tcl man pages. it's a Tcl package that yeets ANSI control sequences at your terminal, and honestly? it's giving keyboard wizard energy. π
we're doing this in parts because it's LONG long, and this is part one. buckle up. π¦
β¨ NAME β¨
term::ansi::send β Output of ANSI control sequences to terminals
like. that's it. that's the whole job description. it sends ANSI control sequences to terminals. no cap. π₯
β¨ SYNOPSIS β¨
first things first, the requirements, because you can't just walk in here without them:
package require Tcl 8.5 9
package require term::ansi::send ?0.2?
so you need Tcl 8.5 or 9, and the package itself, and the version is optional (?0.2? β the ?s mean "this bit is optional", not that it's confused, ok π).
then the actual commands. and there are a LOT of them. like, a concerning amount. let's go. π«Ά
the import + the little guys
::term::ansi::send::import ?ns? ...
::term::ansi::send::eeol
::term::ansi::send::esol
::term::ansi::send::el
::term::ansi::send::ed
::term::ansi::send::eu
::term::ansi::send::es
::term::ansi::send::sd
::term::ansi::send::su
::term::ansi::send::ch
::term::ansi::send::sc
::term::ansi::send::rc
::term::ansi::send::sca
::term::ansi::send::rca
::term::ansi::send::st
::term::ansi::send::ct
::term::ansi::send::cat
::term::ansi::send::qdc
::term::ansi::send::qds
::term::ansi::send::qcp
::term::ansi::send::rd
::term::ansi::send::elw
::term::ansi::send::dlw
::term::ansi::send::eg
::term::ansi::send::lg
look at all those little two-and-three letter icons β¨ they're short, they're punchy, they're doing the most with the least. main character energy fr fr.
the tag + sda crew
::term::ansi::send::scs0 tag
::term::ansi::send::scs1 tag
::term::ansi::send::sda arg...
scs0 and scs1 both take a tag, and sda takes an arg... (that's a variable number of args, bestie, it's flexible like that π).
the sda_ family (yes, all of them, i counted)
::term::ansi::send::sda_fgblack
::term::ansi::send::sda_fgred
::term::ansi::send::sda_fggreen
::term::ansi::send::sda_fgyellow
::term::ansi::send::sda_fgblue
::term::ansi::send::sda_fgmagenta
::term::ansi::send::sda_fgcyan
::term::ansi::send::sda_fgwhite
::term::ansi::send::sda_fgdefault
::term::ansi::send::sda_bgblack
::term::ansi::send::sda_bgred
::term::ansi::send::sda_bggreen
::term::ansi::send::sda_bgyellow
::term::ansi::send::sda_bgblue
::term::ansi::send::sda_bgmagenta
::term::ansi::send::sda_bgcyan
::term::ansi::send::sda_bgwhite
::term::ansi::send::sda_bgdefault
::term::ansi::send::sda_bold
::term::ansi::send::sda_dim
::term::ansi::send::sda_italic
::term::ansi::send::sda_underline
::term::ansi::send::sda_blink
::term::ansi::send::sda_revers
::term::ansi::send::sda_hidden
::term::ansi::send::sda_strike
::term::ansi::send::sda_nobold
::term::ansi::send::sda_noitalic
::term::ansi::send::sda_nounderline
::term::ansi::send::sda_noblink
::term::ansi::send::sda_norevers
::term::ansi::send::sda_nohidden
::term::ansi::send::sda_nostrike
::term::ansi::send::sda_reset
foreground, background, bold, dim, italic, underline, blink, revers, hidden, strike β and then a whole set of no-versions to undo them, plus sda_reset. the way that this list just keeps going. π obsessed. note that it's revers, not reverse β that's not a typo, that's the actual name, don't @ me.
positioning + text + titles
::term::ansi::send::fcp row col
::term::ansi::send::cu ?n?
::term::ansi::send::cd ?n?
::term::ansi::send::cf ?n?
::term::ansi::send::cb ?n?
::term::ansi::send::ss ?s e?
::term::ansi::send::skd code str
::term::ansi::send::title str
fcp wants a row and a col. cu, cd, cf and cb all take an optional n. ss takes optional s and e. skd wants a code and a str. title takes a str. π
the rest of the roster
::term::ansi::send::gron
::term::ansi::send::groff
::term::ansi::send::tlc
::term::ansi::send::trc
::term::ansi::send::brc
::term::ansi::send::blc
::term::ansi::send::ltj
::term::ansi::send::ttj
::term::ansi::send::rtj
::term::ansi::send::btj
::term::ansi::send::fwj
::term::ansi::send::hl
::term::ansi::send::vl
::term::ansi::send::groptim str
::term::ansi::send::clear
::term::ansi::send::init
::term::ansi::send::showat row col text
and that's the full synopsis, every single command, nothing skipped, nothing merged, nothing invented. groptim takes a str, and showat takes row col text. the corner ones (tlc, trc, brc, blc) and the justify ones (ltj, ttj, rtj, btj, fwj) are all here too. β¨
okay that's part one, the synopsis. part two is where we get into what all of these actually DO, and bestie, there's a lot of tea to spill. π« stay tuned π
β¨ DESCRIPTION β¨
Okay bestie, listen UP, because this package is literally the glow-up your terminal has been waiting for. π
This package provides commands to send ANSI terminal control sequences to a terminal. That's the whole vibe. All commands come in two variants:
- one for sending to any channel
- one for sending to
stdout(the main character, obviously)
The commands are defined using the control sequences provided by the package term::ansi::code::ctrl. They have the same arguments as the commands they're based on β with one exception, the variant for sending to any channel. That variant's first argument is always a channel handle, then followed by the original arguments. π«Ά
Below we list only the variant sending to stdout. (The channel one is just this, but with your channel handle up front, iykyk.)
πΈ The Commands πΈ
::term::ansi::send::import ?ns? ...β Imports the commands of this package into the namespace ns. If not specified it defaults tosend. Heads up though: this default is a relative namespace name, i.e. the actual namespace will be created under the current namespace. By default all commands will be imported, but you can restrict it to specific commands by listing them after the namespace to import them into. β¨
π§Ή Erasing Things
::term::ansi::send::eeolβ Erase (to) End Of Line.::term::ansi::send::esolβ Erase (to) Start Of Line.::term::ansi::send::elβ Erase (current) Line.::term::ansi::send::edβ Erase Down (to bottom).::term::ansi::send::euβ Erase Up (to top).::term::ansi::send::esβ Erase Screen.
π Scrolling
::term::ansi::send::sdβ Scroll Down.::term::ansi::send::suβ Scroll Up.
π― Cursor Basics
::term::ansi::send::chβ Cursor Home.::term::ansi::send::scβ Save Cursor. Note: Only one saved position can be handled. This is no unlimited stack. Saving before restoring will overwrite the saved data. π::term::ansi::send::rcβ Restore Cursor (Unsave).::term::ansi::send::scaβ Save Cursor + Attributes.::term::ansi::send::rcaβ Restore Cursor + Attributes.
π Tabs
::term::ansi::send::stβ Set Tab (@ current position).::term::ansi::send::ctβ Clear Tab (@ current position).::term::ansi::send::catβ Clear All Tabs.
π Queries & Device Stuff
::term::ansi::send::qdcβ Query Device Code.::term::ansi::send::qdsβ Query Device Status.::term::ansi::send::qcpβ Query Cursor Position.::term::ansi::send::rdβ Reset Device.::term::ansi::send::elwβ Enable Line Wrap.::term::ansi::send::dlwβ Disable Line Wrap.
π¨ Graphics Mode & Character Sets
::term::ansi::send::egβ Enter Graphics Mode.::term::ansi::send::lgβ Exit Graphics Mode.::term::ansi::send::scs0 tag::term::ansi::send::scs1 tagβ Select Character Set.
Choose which character set is used for default (scs0) and alternate font (scs1). This does not change whether default or alternate font are used, just their definitions. π
The legal tags, and their meanings, are:
Aβ United Kingdom SetBβ ASCII Set0β Special Graphics1β Alternate Character ROM Standard Character Set2β Alternate Character ROM Special Graphics
π Display Attributes
::term::ansi::send::sda arg...β Set Display Attributes. The arguments are the code sequences for the possible attributes, as provided by the packageterm::ansi::code::attr. For convenience this package also provides additional commands, each setting a single specific attribute. π
π Foreground Colours
::term::ansi::send::sda_fgblackβ Set text color to Black.::term::ansi::send::sda_fgredβ Set text color to Red.::term::ansi::send::sda_fggreenβ Set text color to Green.::term::ansi::send::sda_fgyellowβ Set text color to Yellow.::term::ansi::send::sda_fgblueβ Set text color to Blue.::term::ansi::send::sda_fgmagentaβ Set text color to Magenta.::term::ansi::send::sda_fgcyanβ Set text color to Cyan.::term::ansi::send::sda_fgwhiteβ Set text color to White.::term::ansi::send::sda_fgdefaultβ Set default text color (Black).
π¦ Background Colours
::term::ansi::send::sda_bgblackβ Set background to Black.::term::ansi::send::sda_bgredβ Set background to Red.::term::ansi::send::sda_bggreenβ Set background to Green.::term::ansi::send::sda_bgyellowβ Set background to Yellow.::term::ansi::send::sda_bgblueβ Set background to Blue.::term::ansi::send::sda_bgmagentaβ Set background to Magenta.::term::ansi::send::sda_bgcyanβ Set background to Cyan.::term::ansi::send::sda_bgwhiteβ Set background to White.::term::ansi::send::sda_bgdefaultβ Set default background (Transparent).
β¨ On & Off
::term::ansi::send::sda_boldβ Bold on.::term::ansi::send::sda_dimβ Dim on.::term::ansi::send::sda_italicβ Italics on.::term::ansi::send::sda_underlineβ Underscore on.::term::ansi::send::sda_blinkβ Blink on.::term::ansi::send::sda_reversβ Reverse on.::term::ansi::send::sda_hiddenβ Hidden on.::term::ansi::send::sda_strikeβ Strike-through on.::term::ansi::send::sda_noboldβ Bold off.::term::ansi::send::sda_noitalicβ Italics off.::term::ansi::send::sda_nounderlineβ Underscore off.::term::ansi::send::sda_noblinkβ Blink off.::term::ansi::send::sda_noreversβ Reverse off.::term::ansi::send::sda_nohiddenβ Hidden off.::term::ansi::send::sda_nostrikeβ Strike-through off.::term::ansi::send::sda_resetβ Reset all attributes to their default values.
π§ Moving The Cursor
::term::ansi::send::fcp row colβ Force Cursor Position (aka Go To).::term::ansi::send::cu ?n?β Cursor Up. n defaults to1.::term::ansi::send::cd ?n?β Cursor Down. n defaults to1.::term::ansi::send::cf ?n?β Cursor Forward. n defaults to1.::term::ansi::send::cb ?n?β Cursor Backward. n defaults to1.
π₯οΈ Screen & Keys
::term::ansi::send::ss ?s e?β Scroll Screen (entire display, or between rows start end, inclusive).::term::ansi::send::skd code strβ Set Key Definition.::term::ansi::send::title strβ Set the terminal title.
π¦ Box Graphics, The Moment You've All Been Waiting For π¦
::term::ansi::send::gronβ Switch to character/box graphics. I.e. switch to the alternate font.::term::ansi::send::groffβ Switch to regular characters. I.e. switch to the default font.::term::ansi::send::tlcβ Character graphics, Top Left Corner.::term::ansi::send::trcβ Character graphics, Top Right Corner.::term::ansi::send::brcβ Character graphics, Bottom Right Corner.::term::ansi::send::blcβ Character graphics, Bottom Left Corner.::term::ansi::send::ltjβ Character graphics, Left T Junction.::term::ansi::send::ttjβ Character graphics, Top T Junction.::term::ansi::send::rtjβ Character graphics, Right T Junction.::term::ansi::send::btjβ Character graphics, Bottom T Junction.::term::ansi::send::fwjβ Character graphics, Four-Way Junction.::term::ansi::send::hlβ Character graphics, Horizontal Line.::term::ansi::send::vlβ Character graphics, Vertical Line.::term::ansi::send::groptim strβ Optimize character graphics. The generator commands above create way too many superfluous commands shifting into and out of the graphics mode. (Not me calling them out π.) This command removes all shifts which are not needed. To this end it also knows which characters will look the same in both modes, to handle strings created outside of this package. π§
π Odds & Ends
::term::ansi::send::clearβ Clear screen. In essence a sequence of CursorHome + EraseDown.::term::ansi::send::initβ Initialize default and alternate fonts to ASCII and box graphics.::term::ansi::send::showat row col textβ Show the block of text at the specified location.
π BUGS, IDEAS, FEEDBACK π
This document, and the package it describes, will undoubtedly contain bugs and other problems. Like, obviously. π Please report such in the category term of the Tcllib Trackers at http://core.tcl.tk/tcllib/reportlist. Please also report any ideas for enhancements you may have for either package and/or documentation β we love ideas here. π«Ά
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. No cap. β¨
π KEYWORDS π
character output, control, terminal
ποΈ CATEGORY ποΈ
Terminal control
π COPYRIGHT π
Copyright (c) 2006 Andreas Kupries <andreas_kupries@users.sourceforge.net>
And that's a wrap bestie!! π This page is term::ansi::send(n) from tcllib, version 0.2 β go forth and make your terminal absolutely serve. Slay. π
β¨π
π¦ 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