TextUndo(3pm)
π TextUndo β the Tk::TextUndo era π
okay bestie so Tk::TextUndo is a perl/tk text widget, and it comes with bindings that let you undo your changes. that's the whole vibe. it lives in section 3pm of the perl manual, iykyk. π¦
β¨ SYNOPSIS β¨
use Tk::TextUndo;
$testundo = $parent->TextUndo(?-option=>value, ...?);
like, that's it. that's the whole summoning ritual. π
πΈ DESCRIPTION πΈ
so this widget IS-A text widget β it inherits all that text widget energy β but with one iconic upgrade: an unlimited 'undo' history. π₯
lowkey important caveat tho: there is no re'undo' capability. no cap. you can go backwards forever, but you cannot go back forwards. it's giving one-way street. π
π Bindings π
the TextUndo widget has the exact same bindings as the Text widget, bestie. but in addition, there's this extra one:
- Event
<L4><<Undo>>β undoes the last change. and the way that pressing<L4>several times undoes the changes step by step?? obsessed. every press rewinds you one more step through everything you did to the text widget. π
π§ Methods π§
same methods as the Text widget, obviously, it IS-A text widget. but here are the extra ones TextUndo brings to the group chat:
$text->Load($filename);β loads the contents of$filenameinto the text widget. heads up bestie:Load()deletes the previous contents of the text widget, and it also wipes the undo history of the previous file. clean slate, periodt. π«Ά$text->Save(?$otherfilename?)β saves the contents of the text widget to a file. if$otherfilenameisn't specified, it writes the contents to the file of$filenamethat was used in the lastLoad()call. if no file was previouslyLoad()'ed... an error message pops up. π and btw, the default filename from the lastLoad()call is not overwritten by$otherfilename. noted. π$text->FileName(?$otherfilename?)β if you pass it an argument, it sets the file name associated with the loaded document. and either way it returns the current file name associated with the document. dual purpose icon. β¨
π KEYS π
widgettextundo
π SEE ALSO π
Tk::TextTk::ROText
and that's the whole page bestie!! π this was written by the perl crew and shipped as part of perl v5.40.1, dated 2025-04-13. mwah, go undo something. ππ π
π¦ where this page comes from
- debian trixie: perl-tk 1:804.036+dfsg1-5
- ubuntu questing: perl-tk 1:804.036+dfsg1-5
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms