Tk::Tex...uperText(3)

πŸ“¦
version 0.12 Β· 2 versions
, in fedora 43

πŸ’– Tk::Tex...uperText(3) πŸ’–

okay bestie, welcome to the manual page for Tk::Text::SuperText β€” that's the full name, your terminal just shows it squished as Tk::Tex...uperText(3) bc it has no chill about column widths. This is the User Contributed Perl Documentation version, and it's a whole glow-up. ✨


🌸 NAME 🌸

Tk::Text::SuperText β€” an improved text widget for Perl/Tk. like, the text widget but it went to the gym and got hobbies. πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

$super_text = $paren->SuperText(?options?);

yes queen, that's it. you build it off your parent widget and pass it ?options? like every other Tk widget. πŸ¦‹


✨ STANDARD OPTIONS ✨

here's the full roster of standard options this widget takes. all of them. no skipping. πŸ‘‘

-background    -highlightbackground     -insertontime  -selectborderwidth
-borderwidth   -highlightcolor     -insertwidth   -selectforeground
-cursor   -highlightthickness -padx     -setgrid
-exportselection    -insertbackground   -pady     -takefocus
-font     -insertborderwidth  -relief   -xscrollcommand
-foreground    -insertofftime -selectbackground   -yscrollcommand
-ansicolor
See Tk::options for details of the standard options. that's where the lore lives. πŸ“š

and these ones are also standard, but they're the text-y ones:

-height   -spacing1 -spacing2 -spacing3
-state    -tabs     -width    -wrap
See Tk::Text for details of these options. 🫢

🌈 WIDGET-SPECIFIC OPTIONS 🌈

this is the fun part. the options that make it *Super*Text and not just RegularText. let's go one by one, i'm obsessed. πŸ’œ

  • Name: indentMode Class: IndentMode Switch: -indentmode β€” tells the widget how to indent when a new line gets inserted in the text. the possible modes are none, which means no indent at all, or auto, which parks the insertion cursor right below the first non-white space character of the previous line. auto-indent girlies rise. 🧚
  • Name: undoDepth Class: UndoDepth Switch: -undodepth β€” sets the max depth for the undo buffer. a number means: that's how many insert or delete operations can sit in the buffer before the oldest one gets popped out and forgotten forever (rip πŸͺ¦). 0 stops the undo feature entirely, and undef sets unlimited depth. chaos mode unlocked.
  • Name: redoDepth Class: RedoDepth Switch: -redodepth β€” same energy, but for the redo buffer. a number = how many undo operations can be stored before the oldest one is popped out and forgotten. 0 stops the redo feature, undef = unlimited depth. ⭐
  • Name: showMatching Class: ShowMatching Switch: -showmatching β€” a value of 1 activates the matching parentheses feature. 0 deactivates it. that's it, that's the whole vibe check. βœ…
  • Name: matchHighlightTime Class: MatchHighlightTime Switch: -matchhighlighttime β€” sets the number of milliseconds the match highlight stays visible. with a value of 0, the highlight stays on till the next match. commitment issues: none. πŸ”₯
  • Name: matchForeground Class: MatchForeground Switch: -matchforeground β€” sets the foreground color for the char that gets highlighted by the match-parentheses command. πŸ’…
  • Name: matchBackground Class: MatchBackground Switch: -matchbackground β€” sets the background color for the char highlighted by the match-parentheses command. matching set, we love a coordinated fit. πŸ‘‘
  • Name: matchingCouples Class: MatchingCouples Switch: -matchingcouples β€” sets the chars that get searched for a matching counterpart. the format is a simple string with matching chars coupled in left-right order. here's an example: {}[]()"" . for double couples ("") the match is done only on the forwarding chars. iykyk. πŸ¦‹
  • Name: insertMode Class: InsertMode Switch: -insertmode β€” sets the default insert mode: insert or overwrite. pick your fighter. 😭
  • Name: ansiColor Class: AnsiColor Switch: -ansicolor β€” enables or disables use of the Tk::TextANSIColor module. this option was implemented by Jim Turner (THANKS for the support!) β€” shoutout, king, we appreciate you. 🫢🌈

okay that's part 1 bestie, and no we are NOT done, there's more coming πŸ’– don't go anywhere β€”

πŸ’– DESCRIPTION πŸ’–

okay bestie, sit down, hydrate, because Tk::Text::SuperText is literally the glow-up of Tk::Text. It implements so many new features on top of the standard Tk::Text widget while supporting every single one of its standard features. You use it exactly like you'd use Tk::Text β€” no new ritual required. ✨

And now, the new features. Buckle up. πŸŽ€


  • Unlimited undo/redo πŸ”

fr fr, you can undo and redo whatever you deleted or inserted, whenever you want, no limits. To reset the undo and redo buffers, call this method:

$w->resetUndo;
  • Rectangular selections 🟦

Rectangular text zones can be selected, copied, deleted, and shifted β€” with the mouse or with the keyboard. It's giving very spreadsheet-core and we're obsessed.

  • Selection right/left char and tab shift ↔️

Text selections can be shifted left or right by one or more chars, or by a tab.

  • Normal and 'inline' selection paste πŸ“‹

The 'normal' paste is the normal text paste you already know and love:

Paste Buffer:

line x

line y

Text Buffer:

line 1

line2

Normal paste at line 1:

line x

line y

line 1

line 2

The 'inline' paste works like this β€” Inline paste at line 1:

line x line 1

line y line 2
  • Parentheses matching 🧚

To help you inspect nested parentheses, brackets, and other characters, SuperText has both an automatic parenthesis matching mode and a find matching command. Automatic parenthesis matching activates when you type, or when you move the insertion cursor after a parenthesis. It momentarily highlights the matching character if that character is visible in the window. To find a matching character anywhere in the file, position the cursor after it, and call the find matching command.

  • Auto-indenting πŸ“

When you press the Return or Enter key, spaces and tabs get inserted so the insert point lines up under the start of the previous line. Alignment queen.

  • Control codes insertion πŸŽ›οΈ

You can directly insert a non-printable control character in the text. yes, really.

  • Commands are managed via virtual events πŸ‘‘

Every SuperText command is bound to a virtual event, so to call it or to bind it to a key sequence you use the Tk::event functions. The author used this format for key binds so there's no direct key-to-command bind, and this gives more flexibility; however, you can use normal binds too.

Example:

$w->eventAdd('Tk::Text::SuperText','<<SelectAll>>','<Control-a>');

To set default event bindings use this method:

$w->bindDefault;
  • Default key bindings are redefined (not really a feature :) πŸ’…

Every virtual event has an associated public method with the same name as the event, but with the first char in lower case. For example, the <<MouseSelect>> event has a corresponding $super_text->mouseSelect method.

Here's the whole roster, virtual event/command on the left, default key binding on the right:

  • MouseSetInsert β€” <Button1>
  • MouseSelect β€” <B1-Motion>
  • MouseSelectWord β€” <Double-1>
  • MouseSelectLine β€” <Triple-1>
  • MouseSelectAdd β€” <Shift-1>
  • MouseSelectAddWord β€” <Double-Shift-1>
  • MouseSelectAddLine β€” <Triple-Shift-1>
  • MouseSelectAutoScan β€” <B1-Leave>
  • MouseSelectAutoScanStop β€” <B1-Enter>,<ButtonRelease-1>
  • MouseMoveInsert β€” <Alt-1>
  • MouseRectSelection β€” <Control-B1-Motion>
  • MouseMovePageTo β€” <2>
  • MouseMovePage β€” <B2-Motion>
  • MousePasteSelection β€” <ButtonRelease-2>
  • MoveLeft β€” <Left>
  • SelectLeft β€” <Shift-Left>
  • SelectRectLeft β€” <Shift-Alt-Left>
  • MoveLeftWord β€” <Control-Left>
  • SelectLeftWord β€” <Shift-Control-Left>
  • MoveRight β€” <Right>
  • SelectRight β€” <Shift-Right>
  • SelectRectRight β€” <Shift-Alt-Right>
  • MoveRightWord β€” <Control-Right>
  • SelectRightWord β€” <Shift-Control-Right>
  • MoveUp β€” <Up>
  • SelectUp β€” <Shift-Up>
  • SelectRectUp β€” <Shift-Alt-Up>
  • MoveUpParagraph β€” <Control-Up>
  • SelectUpParagraph β€” <Shift-Control-Up>
  • MoveDown β€” <Down>
  • SelectDown β€” <Shift-Down>
  • SelectRectDown β€” <Shift-Alt-Down>
  • MoveDownParagraph β€” <Control-Down>
  • SelectDownParagraph β€” <Shift-Control-Down>
  • MoveLineStart β€” <Home>
  • SelectToLineStart β€” <Shift-Home>
  • MoveTextStart β€” <Control-Home>
  • SelectToTextStart β€” <Shift-Control-Home>
  • MoveLineEnd β€” <End>
  • SelectToLineEnd β€” <Shift-End>
  • MoveTextEnd β€” <Control-End>
  • SelectToTextEnd β€” <Shift-Control-End>
  • MovePageUp β€” <Prior>
  • SelectToPageUp β€” <Shift-Prior>
  • MovePageLeft β€” <Control-Prior>
  • MovePageDown β€” <Next>
  • SelectToPageDown β€” <Shift-Next>
  • MovePageRight β€” <Control-Next>
  • SetSelectionMark β€” <Control-space>,<Select>
  • SelectToMark β€” <Shift-Control-space>,<Shift-Select>
  • SelectAll β€” <Control-a>
  • SelectionShiftLeft β€” <Control-comma>
  • SelectionShiftLeftTab β€” <Control-Alt-comma>
  • SelectionShiftRight β€” <Control-period>
  • SelectionShiftRightTab β€” <Control-Alt-period>
  • Ins β€” <Insert>
  • Enter β€” <Return>
  • AutoIndentEnter β€” <Control-Return>
  • NoAutoindentEnter β€” <Shift-Return>
  • Del β€” <Delete>
  • BackSpace β€” <BackSpace>
  • DeleteToWordStart β€” <Shift-BackSpace>
  • DeleteToWordEnd β€” <Shift-Delete>
  • DeleteToLineStart β€” <Alt-BackSpace>
  • DeleteToLineEnd β€” <Alt-Delete>
  • DeleteWord β€” <Control-BackSpace>
  • DeleteLine β€” <Control-Delete>
  • InsertControlCode β€” <Control-Escape>
  • FocusNext β€” <Control-Tab>
  • FocusPrev β€” <Shift-Control-Tab>
  • FlashMatchingChar β€” <Control-b>
  • RemoveMatch β€” <Control-B>
  • FindMatchingChar β€” <Control-j>
  • JumpToMatchingChar β€” <Control-J>
  • Escape β€” <Escape>
  • Tab β€” <Tab>
  • LeftTab β€” <Shift-Tab>
  • Copy β€” <Control-c>
  • Cut β€” <Control-x>
  • Paste β€” <Control-v>
  • InlinePaste β€” <Control-V>
  • Undo β€” <Control-z>
  • Redo β€” <Control-Z>
  • Destroy β€” <Destroy>
  • MenuSelect β€” <Alt-KeyPress>
  • Public methods 🫢

here's the full list, copy it into your notes app bestie:

$widget->mouseSetInsert
$widget->museSelect
$widget->mouseSelectWord
$widget->mouseSelectLine
$widget->mouseSelectAdd
$widget->mouseSelectAddWord
$widget->mouseSelectAddLine
$widget->mouseSelectAutoScan
$widget->mouseSelectAutoScanStop
$widget->mouseMoveInsert
$widget->mouseRectSelection
$widget->mouseMovePageTo
$widget->mouseMovePage
$widget->mousePasteSelection
$widget->moveLeft
$widget->selectLeft
$widget->selectRectLeft
$widget->moveLeftWord
$widget->selectLeftWord
$widget->moveRight
$widget->selectRight
$widget->selectRectRight
$widget->moveRightWord
$widget->selectRightWord
$widget->moveUp
$widget->selectUp
$widget->selectRectUp
$widget->moveUpParagraph
$widget->selectUpParagraph
$widget->moveDown
$widget->selectDown
$widget->selectRectDown
$widget->moveDownParagraph
$widget->selectDownParagraph
$widget->moveLineStart
$widget->selectToLineStart
$widget->moveTextStart
$widget->selectToTextStart
$widget->moveLineEnd
$widget->selectToLineEnd
$widget->moveTextEnd
$widget->selectToTextEnd
$widget->movePageUp
$widget->selectToPageUp
$widget->movePageLeft
$widget->movePageDown
$widget->selectToPageDown
$widget->movePageRight
$widget->setSelectionMark
$widget->selectToMark
$widget->selectAll
$widget->selectionShiftLeft
$widget->selectionShiftLeftTab
$widget->selectionShiftRight
$widget->selectionShiftRightTab
$widget->ins
$widget->enter
$widget->autoIndentEnter
$widget-> noAutoindentEnter
$widget->del
$widget->backSpace
$widget->deleteToWordStart
$widget->deleteToWordEnd
$widget->deleteToLineStart
$widget->deleteToLineEnd
$widget->deleteWord
$widget->deleteLine
$widget->insertControlCode
$widget->focusNext
$widget->focusPrev
$widget->flashMatchingChar
$widget->removeMatch
$widget->findMatchingChar
$widget->jumpToMatchingChar
$widget->escape
$widget->tab
$widget->leftTab
$widget->copy
$widget->cut
$widget->paste
$widget->inlinePaste
$widget->undo
$widget->redo
$widget->destroy
$widget->menuSelect

πŸ‘‘ AUTHOR πŸ‘‘

Current maintainer is Alexander Becker, asb@cpan.org. πŸ’Œ

Originally written by Alessandro Iob.


πŸ“œ LICENSE πŸ“œ

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


🌈 SEE ALSO 🌈

Tk::Text Tk::ROText Tk::TextUndo


πŸŽ€ KEYWORDS πŸŽ€

text, widget


and that's a wrap on the whole page, bestie 🫢 this was perl v5.42.0, dated 2025-07-25, and it's the Tk::Tex...uperText(3) manual β€” go forth and make your text widget absolutely ate πŸ’…βœ¨
πŸ“¦ where this page comes from