term::ansi::code::ctrl(n)

πŸ“¦
version 2.0 Β· 2 versions
, in fedora 43, fedora 44, nixos 26.05, nixpkgs unstable

✨ 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 col sitting in the middle of all the ctrl commands. 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 is ctrl. 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 Set
  • B β€” ASCII Set
  • 0 β€” Special Graphics
  • 1 β€” Alternate Character ROM Standard Character Set
  • 2 β€” 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 package term::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 to 1.
  • ::term::ansi::code::ctrl::cd ?n? β€” Cursor Down. n defaults to 1.
  • ::term::ansi::code::ctrl::cf ?n? β€” Cursor Forward. n defaults to 1.
  • ::term::ansi::code::ctrl::cb ?n? β€” Cursor Backward. n defaults to 1.
  • ::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 (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