2.10 (2026-11-18): Value settings are recorded for undo whenever -undo is on (the owner's decision; BUGS 41): "block nodedata", "tag data", "mark data" and "block data" were recorded only inside an edit step (2.09), and outside it the value replaced was freed at once, so the undo of an earlier edit left the new value where the old one had been. Now the value replaced waits in the undo step, the undo gives it back, the redo sets the new one again; -valuecommand is told "stash" (with -undo off, "drop", as before). With -autoseparators a setting joins the step that is open (the edit before it) without ending it; where none is open (after undo, redo, reset, the end of an edit step, a block command) it starts one, which the next settings join and the next edit ends. A setting keeps the steps that can be redone (it moves no text), and neither it nor its undo and redo count for "edit modified" (the undo of a step holding settings inside an edit step made the widget modified in 2.09). The undo of a mark's setting tells -valuecommand where the mark is then. Programs that set values they do not want undone switch -undo off around those calls. The manual: "Undo and redo of block and tag changes", "Several changes as one undo step", "Values". Tests in t/values.t, t/step.t and t/data-slots.t; the tests of the old rule set those values with -undo off. The frames of split lines take room (the owner's request; BUGS 37): in the default layout the leaves move in by the room of the frames (the stroke widths and one pixel between strokes) and the block is that much bigger on each side; under a layout callback a child that will be a stack with frames is reported bigger by the room on each side, and its leaves go the room in from each side of the box the callback gives it. The frames are no longer clipped to the display line. The split lines take room too: in a stack the lower leaf is below the upper one by the room of the lines between them (of the larger of two halves), the lines in that room instead of on the top rows of the lower leaf under its text; a group of leaves is reported to a layout callback with that room in its height. Blocks with lines or frames are drawn bigger than in 2.09 unless -splitlines is off. The manual: "Split lines and frames", "Layout callback". Tests in t/splitlines.t. The two builds of the value containers are called value=Perl (the default, the Perl value itself) and value=C-array (typed slots in C arrays, ETEXT_DATA_ARRAYS=1 perl Makefile.PL) in the documents; the entries above, and older notes, call them representation A and B. A refused element of the result of a layout callback no longer leaves the elements before it applied: leaves they had moved or hidden get the default layout back, and lines they had stolen are dropped, so the block is laid out as if it had no callback, as the manual says (BUGS 39). Test in t/regress.t. "get" of an empty range (the same index twice, or from "end") gives an empty string, as Tk::Text, not undef (BUGS 40). Test in t/regress.t. 2.09 (2026-11-12): Split lines and frames (the manual's "Split lines and frames", in "Display of blocks"; the owner's design, STRICTURES.md 8.8 to 8.11): where the widget itself lays leaves of a block out one under another (a "stack": all the leaves in the default layout, or the leaves that a layout callback gave one box, such as a group it saw as one child with a repeat count), it draws the structure of the tree that is hidden there. Between two leaves of a stack, lines across the stack show the depth of the separator between them (as "block list" reports it) in binary: bit 0 a dotted line, bit 1 a dashed line, bit 2 a solid line, bit 3 and each higher bit a solid line 3 pixels wide; depth 0 has no line; with leaves of different depths the left half shows the depth less the defect of the upper leaf, the right half the depth less the defect of the lower one. Around a stack, frames show the same way the number of nodes with a single child from the node the stack is expected to be: the root in the default layout, the node at the distance -layoutdepth from the root under a callback (no frames without -layoutdepth, or when the stack is not all the leaves of that node). The lines and frames take no room, are drawn in gray50 under the text and before the other ornaments of the block, and are clipped to the display line. New boolean option -splitlines of block types, true by default: "block configure TYPE -splitlines 0" switches them off. Blocks that have such structure are drawn differently from 2.08 unless the option is switched off. Test t/splitlines.t. A negative count in the result of a layout callback (leaves to hide, or the ordinal of a stolen line) crashed the widget; it is refused now, as other bad results (BUGS 38). Cut and paste with structure (the manual's new section "Cut and paste with structure"; the design note doc-design/STRICTURES.md on the branch strictures-design, sections 8 and 9): "block list -values index1 index2": the separators of a block that is not listed whole are [depth, defect, the value of the leaf that begins after the separator, the values of the nodes that begin there, from the lowest up], and the list starts with a TagOn (with a copy of the value) for every run that is already on where the range starts. "block cut index1 index2" returns that list and deletes the range; where this deletion joins two leaves or nodes, the joined one never takes the end side's value (it is in the list, with the separator that began its owner): the leaf and the nodes in which the range starts are left as they were. "block paste index list ?-marks?" puts a list in as one command (the insertion the undo of a deletion makes, made public): text with its tags, separators at their depths (levels are added below the root where the tree has too few), whole blocks with instance data and node values, images and windows, and the values of the separators and of the runs; marks only with -marks. It returns the range it filled. Its undo deletes that range as "block cut" does and takes the added levels away. Cut then paste at the same place gives the text, the trees and the values back for every range that cuts no block, in a block whose leaves are equally deep; two pieces of two blocks can be exchanged, with or without a third place for one of them. Both commands are undo steps of their own; -valuecommand gets the causes "block cut" and "block paste". Test t/cutpaste.t. Perl: clipboardCopy, clipboardCut and clipboardPaste keep the list of the selection beside the string they put on the clipboard, and paste the list (with "block paste") while the clipboard still holds that string; else the string, as before. Provisional (BUGS 36): the type of the block is not asked at the joins and splits; in a tree with leaves of different depths a cut can leave the leaf it started in one level deeper. "block level index ?level?": the depth of the separator at an index, or its change, without moving text: a higher depth cuts the nodes that hold both leaves as "block split" at that depth would have (levels are added below the root where needed), a lower one joins them as the deletion of the separator would; the two leaves and their values stay, where deleting the separator and splitting again loses the value of the second leaf. Recorded for undo (the core had this for the undo of "block insert" only: TkIBTreeSetSeparatorLevels); -valuecommand gets the cause "block level". Test t/level.t. Several commands as one undo step: "edit step begin" ... "edit step end" (they nest; "edit step" tells how many are open). Between them no separator goes into the undo history (-autoseparators puts none, "edit separator" does nothing), and the setting of a value (block nodedata, tag data, mark data, block data) is recorded: the value the place had goes into the step, the undo and the redo exchange the two (-valuecommand: "stash" where an unrecorded set tells "drop", then "stash" and "restore", "discard" with the step). Outside a step setting a value stays unrecorded, as before. Perl: $w->editStep(CODE, ARGS) runs the code in a step and ends the step also when the code dies. clipboardPaste over a selection (a cut and a paste) is one step. Test t/step.t. 2.08 (2026-11-12): Ornaments (the manual's new section "Ornaments"; provisional): lines, polygons, rectangles and ovals drawn over or under the text, whose coordinates are reference points computed from the places where characters are drawn (the anchors of the box of a character or of a range, their weighted means, offsets, the x of one point with the y of another, minima and maxima), computed anew at every redisplay; with marks in their indices they follow the text. Subcommand "ornament" (create, delete, names, configure, cget, points, coords, point). Test t/ornament.t. Private marks: an index of an ornament that names no mark and no tag becomes a mark of the ornament's own, invisible to the program (mark names/next/previous, dump, block list; names starting with \001 are reserved), so that the point stays on its character; the wrappers [leftward => INDEX] and [rightward => INDEX] make one of a given gravity. An ornament all of whose indices are private marks is deleted with its text (option -keep prevents it); undo does not bring it back. The stand-in of a position that is not displayed takes the x the position had when last displayed (else the middle of the text area, or with the new widget option -ornamentproportional the place proportional to its offset in its line): no line is laid out for it any more. New points [line => I1, I2, N, ANCHOR] (the piece of a range on its N-th display line) and [outline => I1, I2] (all the corners of a range's outline, in a line or a polygon); anchors mw, m, me (the mid line) and [FX, FY] (fractions of the box). Types arc (-start, -extent, -style as on a canvas) and text (-text, -font, -anchor); distances of an offset in em and ex of the font of its point (emmin, emmid, emmax, exmin, exmid, exmax for the fonts of a range); the point [yx => P1, P2]. "mark next" skipped a mark at the very start of the first leaf of a block; "mark previous" missed the marks in the leaves of a block before the index but the first, and those after the block on its line (BUGS 35). A layout callback may return ornaments of the block among its lists: [TYPE, X1, Y1, ..., -option => value, ...], in pixels from the top left corner of the block, with the options of "ornament create"; drawn with the block every time it is drawn, under its text (among the stolen lines, in the order returned) or over it; not leaves; their options are parsed once per layout and kept with it. A bad one is a background error, as other bad results. (Manual: "Layout callback", "Ornaments of blocks".) Templates on a block type: "block configure TYPE -ornaments LIST", ornaments drawn for every displayed block of the type, whose points are computed from the boxes of the block and of its leaves with the new points [leaf => K, ANCHOR] and [block => ANCHOR] (and mix, offset, xy, yx, min, max of them; no indices). A template naming a leaf that is missing or not shown is not drawn for that block. "block cget TYPE -ornaments" gives the list. Demo: the strokes are ornaments instead of stolen lines (block addline still works, for the LR delimiters and the backgrounds): the Radical's sign is a broken line its layout callback returns, that grows with the contents (a tick, a stroke down to the bottom, up to the top left of the contents, the bar over them) instead of a glyph with a vertical line added for tall contents; the Fraction's bar is a template (-ornaments of the type); the rules of Table and SpanTable and the lines of Std are black rectangles returned by their callbacks. The tests that looked at the stolen lines of layout results look at the ornaments. Demo: a menu "Ornaments": "Box under selection" (a light filled rectangle under the selected text), "Arrow from mark" (the first use remembers the start of the selection in the mark ornArrowFrom, the second draws an arched red arrow from there to the selection), "Brace under selection" (an underbrace, a smoothed line sized in em), "Remove all". Their indices are the selection's ends, private marks of the ornaments. Test t/demo-ornaments.t. A smoothed ornament that is straight on a half pixel no longer jitters between two rows of pixels (rounding). 2.07 (2026-11-12): "bbox" of a position inside a leaf of a block that has been drawn was off downwards by the top of the block in the window (BUGS 32). "bbox" of the tail of a block at the end of a display line reached to the right edge of the window, not just over its last leaf (BUGS 33). A mouse position beyond the end of a wrapped display line ending with a multi-byte character ("@x,y", the mark "current") was inside the character; a mark set there split it into NUL bytes (BUGS 34). Demo: two block types whose layout callbacks take the tree as it is: OpLimits, a big operator with limits R( op | Lower( l1 | l2 ) | upper | index ) (a ragged tree; flattened, empty, missing and extra parts laid out too), and SpanTable, a table whose cells span columns and rows by their values ({ cols => 2, rows => 3 } or "2x3"; HTML's rule for the slots covered; the columns and rows a cell does not fit in grow; rules between the cells). The demo's blockInsert writes down any tree (Tk::Text::Node), values (Tk::Text::Valued), instance data and tagged strings. Tests t/demo-oplimits.t, t/demo-table.t; t/display-random.t lays them out after random edits (ETEXT_DISPLAY_RANDOM for more seeds). Demo: blocks re-created by File/Open (save.tsf) and Edit/Int Paste get their instance data and node values back (a SpanTable kept no spans). 2.06 (2026-11-11): Ragged trees: the leaves of a block's tree may be at different depths (the manual's new section "Ragged trees"). The widget keeps the stored tree uniform, a shallower leaf hanging from its parent through padding nodes (a flag in the node), which no command names; every command that names nodes follows the real tree: block at and block of (a node is a list of its children, leaves and nodes side by side), block nodedata (levels count real ancestors from the leaf; negative levels from the root), the addresses of values in undo steps and in -valuecommand's $where (where the node's first leaf starts, the level counted from that leaf), block trim, and the layout callback's arguments (with -layoutdepth, a shallower leaf is presented inside lists of one element down to that depth). The uniform tree shows only in block list and in the levels of block split. New command "block sprout index1 ?index2?": with two indices the leaf holding the range becomes three children of its parent, the text before the range, a new node holding the range as its only leaf, and the text after it (a range that starts on the delimiter before the leaf, or ends just after the one after it, makes no start or end piece); with one index (decision O8) the leaf the index names gets a new node above it, the only leaf of a block included. Returns the number of separators put in. New command "block flatten index level": the node "level" real levels above the leaf of index becomes one leaf; at the root the block becomes a single leaf (block at gives one number, block list the depth -1, the layout callback gets the leaf alone, nodedata 0 and -1 name it; a newline, a split or block sprout give it a root again). Returns the number of separators deleted. Deletions that join two leaves of different depths first give the shallower one new nodes (WRAPs) until both are equally deep, then join them as before; a newline typed in a leaf, and block split at level 0, make a sibling at the leaf's depth. Format change of block list (decision L1): the separator before a leaf with padding is a pair [depth, defect] (a blessed array of class Tk::Text::BlockSeparator, the defect being the number of padding nodes above the leaf), and a padded first leaf gets [undef, defect] in front of it; the list of a tree whose leaves are equally deep is as before. A single-leaf block has the depth -1. The undo and the redo of every structural edit are exact for ragged trees: the tree, the padding and the values come back (the undo is the inverse sequence of the edit's steps; its lists carry the padding). block sprout and block flatten are recorded for undo, each a kind of edit of its own for -autoseparators. -valuecommand: the steps of block sprout, block flatten and of deletions across depths are told one by one (a WRAP or a PULL OUT changes the level in the address of the nodes above: "move" with the place after the step); new event "copy" for the value block sprout shares between the pieces; new event "new" (decision O5, option A), told before a change for each node or leaf it creates without a value, with its place after the change and the value undef (newlines in blocks, block split, block insert, block sprout, the WRAPs of a deletion, the leaves a dissolved block leaves in the block around it, a single-leaf block's new root); not told for what an undo or a redo re-creates. block split now tells "move" for the root's value when it adds levels: it inserts the new nodes between the root and its children, so the root's address grows. The error of block nodedata for a level beyond the root says "... has N levels above this leaf" (it said "above its leaves"). PROVISIONAL (BUGS 28): which sequence of steps an edit uses (block flatten's recipe, a deletion's WRAPs of the shallower leaf), the value rules of the steps (a join keeps the start side's value; a pull out the node's; block sprout shares the former leaf's value), and the -valuecommand events of these commands ("copy", "new", the steps told one by one). Fixed (BUGS 29, since 2.01): the undo of a deletion inside a block re-created the separators of level above 0 with the tags of the place, also those the deleted range had off there. Fixed (BUGS 30, since 2.05): -getflags was ORed into the widget's own text extractions, so reserved bits changed what block list and the undo's records contained (0x200 left the node values out). The widget now uses only the documented bits and ignores the others. Fixed (BUGS 31, since 2.05): a value set, after a deletion that dissolved a nested block, on a leaf the dissolution made in the enclosing block went, with the undo, to the leaf of the re-created block at the same place, and the redo, which dissolves that block again, took it into the undo step with the block's values: the leaf came back without it. Such a value now waits in the undo step (told "stash"), as one whose place does not exist after the undo does (BUGS 26), and the redo gives it back to the leaf of the enclosing block (told "restore"). The random -valuecommand test no longer lets an undo or a redo leave a node without a value. Tests: t/ragged.t, t/flatten.t, t/getflags.t; t/stress.t and t/valuecommand-random.t edit ragged trees at random, undo and redo at once and compare the block list with values and the shape of every block; the random -valuecommand test checks in half of its widgets, where every node has a value before each command, that every node a command creates is told "new". 2.05 (2026-11-10): The values the widget keeps for Perl (on the nodes and leaves of blocks, marks, runs of tags, and as the instance data of blocks) live in data containers (tkTextData.h): the Perl value is to become one part of what is attached there, the rest holding, for example, switches for the operations that now follow one fixed rule (how the data of two merged tag runs is combined). All code goes through the operations of the header; the merge policy (N5, the first container present wins) is one function, TkTextDataMerge. Two representations, chosen when building: A (the default) is the Perl value itself and compiles to what the code did before; B ("ETEXT_DATA_ARRAYS=1 perl Makefile.PL", adds -DTK_TEXT_DATA_ARRAYS=1) is one pointer to a block of typed slots (a size, a capacity, an array of slots and an array of unsigned char type codes), of which the Perl value is the slot of type TK_TEXT_DATA_LANG. In both the field is one pointer wide. Undo records, undo atoms and the list of values to free carry whole containers. The Perl interface (block nodedata, mark data, tag data, block data, the [name, value] elements of block list, dump -values) reads and writes only the Perl value, as before: setting undef removes only that part. Limits of B, documented in the header: block list carries only the Perl values, so the other slots do not follow text re-inserted from a list, and the instance data of a block deleted and brought back by undo comes back from the list. A widget built with B has a hidden subcommand for the tests (_dataslot), and t/data-slots.t (skipped with A) checks that a slot survives drop, undo, redo and merges and that each container is freed once. Nothing changes for Perl code: the test suite gives the same results with A as 2.04, and passes with B. BUGS 22 and 23, found on the way: the instance data of a block is freed at once, not when the widget command ends, when "block data" replaces it and when an undo step that listed it is discarded. demo/etext.pl starts with its "#!/usr/bin/perl" line again: two stray lines, a copy of two lines of its body, came before it. Fixed: deleting a block of a type with -empty => 1 unlinked its segment and never freed it (72 bytes per block, since the 1997 code): t/stress.t lost 349 such pieces under valgrind, now none. t/leak.t watches the process size over 50000 such deletions. Fixed (BUGS 22): the instance data that "block data" replaces, or removes with undef, is freed when the widget command ends, as every other value, and no longer at once inside it: its DESTROY runs under the stopgap (commands that would modify the widget are refused), still before blockData returns. Fixed (BUGS 23): the undo of a deletion keeps the instance data of the blocks it deletes or dissolves as a record of its own (addressed by the block's head), as it keeps node and run values, and no longer as a copy in its block list, which now leaves instance data out. The undo gives the whole container back to the block it re-creates (with representation B, its other slots too), the redo takes it again, and a discarded step (edit reset, -maxundo, a new change after an undo) frees it when the widget command ends, under the stopgap. The same for the redo of an insertion, which re-inserts a block list. Setting block data now counts as setting a value for the snapshot an undoable deletion takes (BUGS 13). Fixed (BUGS 20): "tag names" at the head of a block reports the tags in effect there, as "tag ranges", "dump" and the searches do; it left out a tag that switches off inside the block. The display, the elide test and the mouse bindings keep the rule of 1997: such a tag does not style the block as a whole. The manual's "the behaviour of tags on the start of block is undefined" says so instead. Fixed: a tag with -elide on that started before a block and ended inside it hid the whole block and the rest of the line, text it does not cover included; the two loops of the display that skip hidden text now stop at a block inside which such a tag switches, and the block draws what the tag does not cover (BUGS 24). The manual ("Node values and editing") says what a deletion does to the last of a block's nodes directly above the leaves (and to its ancestors below the root): they hold the block's tail, so they are never deleted whole; when all their leaves are deleted they are joined to the node before them, and their values follow the rule for joined nodes (moved if that node has none, dropped otherwise). It said that such a node was deleted with its value. t/values.t pins it. Fixed (BUGS 18): the undo of a block insert whose range crossed nodes of an enclosing block gives the nodes back exactly, with their values. The block insert flattens the separators of its range (the leaves become children of the new block's single node), and the undo dissolved the block at level 0; the undo step now records the level of each separator in the range and of the one after it, and the undo sets each back to its level after dissolving the block (splitting or joining nodes; no text moves), before the values come back to the nodes at their addresses. The redo stays exact. The review's random undo/redo exactness check, which failed on 11 of 300 runs (all this bug), passes on all of them. t/demo.t hides its probe MainWindow instead of destroying it, and destroys it last: Perl/Tk's option-lookup cache goes stale when a MainWindow is destroyed, and the demo's MainWindow, created after it, crashed now and then (BUGS 21, under Wine). Fixed (BUGS 25): an -empty block that had moved to another line (a newline or a block split before it, block insert nesting it) kept pointing to its old line; "block at" on its head crashed. The B-tree check under "debug" looks for it. Fixed (BUGS 26): the undo of a deletion that dissolved a block freed a value set after the deletion on a leaf made of what was left of the block; it waits in the undo step now, and the redo gives it back. New option -valuecommand (BUGS 17): a callback told, before a command changes anything, which values the change will detach and where they are, while the widget is unchanged: $cb->($widget, $event, $kind, $where, $value, $cause). This first step covers setting and unsetting values (block nodedata, tag data, mark data, block data, mark unset), the runs that tag add, tag remove and tag delete drop or merge, the values an undo or a redo gives back ("restore") or moves aside, and those of undo steps thrown away ("discard", at the end of the command). A detach that was not foreseen is reported "late" after the change, and under "debug" the command fails. While the callback runs, the widget refuses the commands that would change it. t/valuecommand.t. The look-ahead of -valuecommand covers the structural changes too: deletions (leaves and nodes deleted or joined, as the manual's rules say, blocks deleted or dissolved with all their values and instance data, runs gone or merged, also around the heads and tails of dissolved blocks), block insert (the two parts of the cut leaves joined, nodes left without leaves), block trim, and the joins of nodes by which the undo of a block insert sets the separator levels back. t/valuecommand-random.t runs random commands (undo and redo included) on widgets with nested blocks and values everywhere, with "debug" on, and checks that every value detached was told before, at a place that names it during the call, that every value freed was told drop or discard, and that no late event occurs. The manual documents the option ("Telling the program: -valuecommand"). The stopgap of 2.04 is gone (BUGS 17): a DESTROY method run while the values a command dropped are freed may change the widget again. Such a change is an undo step of its own; the values it drops are freed in the same pass; a chain of such changes is refused 10 deep. Only the -valuecommand callback is refused changes (same list of commands as the stopgap had). A ready-made -valuecommand: -valuecommand => 'DETACH' calls the method DETACH of the widget (in eText.pm), which calls $value->DETACH($widget, $event, $kind, $where, $cause) for a value that is an object with such a method, and skips the others. The 10 rounds of values freed in which DESTROY methods may change the widget are a limit that the program can raise (the owner's design): when a change from a DESTROY method is about to be made at the limit, the widget calls $object->DESTROYmult($n, $limit) on the object whose DESTROY method makes it ($n counts the requests of the freeing pass from 1, $limit is the current limit, 10 at first), and a positive integer $more raises the limit to $limit + $more; anything else, no such method, a non-object, or a method that dies (a background error) and the change is refused as before, the error naming the limit. Asked is the innermost DESTROY running, so an object held inside a value answers for its own change. The limit and the count reset with each outermost command. t/destroymult.t. The manual says what happens when Perl code the widget calls dies ("When Perl code called by the widget dies"), and t/dying.t checks it: a DESTROY method that dies, or that lets a refused change leave it, gives Perl's "(in cleanup)" warning (only where warnings are on: the refusal comes from a Perl/Tk method compiled without "use warnings", so it is warned only under perl -w, and an eval in DESTROY catches it), and the values and the command go on; a -valuecommand callback, a DETACH method or DESTROYmult that dies is a background error and the command goes on. Each value is freed once in every case, and nothing the callback got is kept. Postponed (BUGS 27): -valuecommand tells before the command changes anything only for commands that make one change; those that make several (edit undo and redo, insert with tag lists, tag add and remove over several ranges, a deletion through the end of the text) tell before each of their changes, and a value an undo or a redo displaces is told just before it moves. The manual's -valuecommand section says so in a note marked "Postponed". 2.04 (2026-11-09): Undo records block insert, block split, block trim, tag add and tag remove (BUGS 12 and 16), each reversed exactly: the undo of a split deletes its separator (and takes away the levels it added above the root), that of a block insert dissolves the block by deleting its head (the leaves it moved whole get their values back, its instance data and own values wait in the step for the redo), that of a trim adds the root again, those of tag add and remove give the tag in the range exactly the ranges it had; the redo does the change again. What they drop (merge losers, emptied nodes, a trimmed root's value, removed runs) goes into the undo step, as for deletions. Each is an edit kind of its own for -autoseparators (Tk's rule: a change of kind starts a step). "sel" is not recorded, nor a tag change that changes nothing. These changes now count for "edit modified". Not exact: the undo of a block insert whose range crossed nodes of an enclosing block does not re-create the node boundaries (BUGS 18). A deletion through the end of the text now records the tags it takes off the final newline, and its undo puts them back. "block split" on the last (dummy) line splits at the end of the line before it. New test: t/undo-block.t; t/stress.t runs all of it at random. dump -values: every entry gets a fourth field, the value of a mark (mark data) or of the run a tagon starts (tag data), undef for the other entries and for marks and runs without a value, so that the list stays one of entries of one length; a -command callback gets it as a fourth argument. Not part of -all; alone it means -all -values. Node values and block instance data are not dumped (block list shows them). Without -values, dump is unchanged. Fixed: the undo of a deletion gave the value of a run starting where the deletion started to a run of the same tag re-created inside the restored text (the text is re-inserted piece by piece, and the piece joined the run for a moment), and the redo then lost the value; release 2.03 too. A stopgap: while the values a command dropped are being freed (a DESTROY method runs), the commands that would modify the widget fail with "cannot modify .t while its values are being freed"; reading commands and those that only change the view work. The manual lists the commands refused (section "When values are freed"); BUGS 17 says what the real fix is to be. New test: t/freeing.t. The manual describes block insert exactly: the ranges accepted, a range in a block crossing leaves and nodes, the leaves moved becoming children of the new block's single node (the structure above them flattened, their separators of depth 0), and what is left in the enclosing block. block list: a mark with a value (mark data) is listed as MarkLeft or MarkRight holding [name, value], as a valued run is listed as TagOn [name, value]; a mark without a value is listed as before. Inserting a list back (the undo's path) gives a mark the value of such an element; the undo's own lists leave mark values out, as they leave node and run values out. The demo reads mark elements in both forms (Tk::Text::MarkLeft::name, MarkRight::name). The redo of an insertion re-inserts it exactly: undoing an insertion records the inserted range in block-list form (as a deletion records what it deletes), and the redo inserts that list instead of the plain string (Tk 8.4's way). The text comes back with the tags it was inserted with, the separators it made in a block and the marks in it, and its runs get their values back, which the redo used to free (BUGS 11). Fixed: a backward tag search inside a block whose root has nodes two levels deep (tag prevrange, finding the run of a tag value, and through these an undo) walked off the end of a list of nodes and crashed (FindTagEnd); release 2.03 too. Fixed: "block list" of a block whose only leaf is empty left out the marks and tag toggles in that leaf, so the undo of a deletion over such a block did not put them back (a mark stayed where the deletion had moved it, a tag ended on the wrong side of the block); release 2.03 too. Fixed: the redo of a block insert re-created the block even when its type had been made -empty since the undo, over contents (the command refuses that), and the display then crashed; such a redo does nothing now, as one whose block type was deleted. Fixed: the redo of a block trim did not look again whether the root had a value, so a root value set or unset between the undo and the redo put the values on the wrong nodes after redo and undo. Fixed: "tag add b end" (an empty range) made an undo step that did nothing, and set the modified flag; it records nothing now. Fixed: with -undo off, tag add and tag remove did not set the modified flag (insertions and block changes do, and the manual says they count); they do now, but for "sel" and changes that change nothing. While values are being freed, the rule is now the same for tags and block types: a query of tag configure, tag bind or block configure works if the tag or type exists, and is refused if it would create one (tag configure and tag bind queries used to create the tag, while every block configure was refused). Fixed: a block insert over several lines whose second or later line was the first one on display left the view pointing into a line moved into the block, and the next redisplay crashed; the undo and redo of block changes reached it through "see". The view now goes to the first line of the range; release 2.03 too. The same stale view made the undo of a deletion abort ("got index in internal BTree") and a redisplay abort ("SplitSeg reached end of line!") after other block inserts; gone with it. Fixed: in a block whose tree has inner nodes, a tag search did not stop at its end when that end was in a node of the block without a toggle of the tag, and the first toggle of a tag in a block was placed one position (or a skipped node) too far left; so "tag remove" over a range crossing a node boundary removed the tag far beyond the range, and the undo of a tag add lost the ranges the tag had (release 2.03 too). Fixed: a deletion that the rule of the final newline makes empty (only that newline was named) was recorded as an undo step that did nothing, and set the modified flag; it records and modifies nothing now, unless the newline had tags, which it takes off as before (that is recorded); release 2.03 too. Fixed: a block insert over lines in different nodes of the text's B-tree (from about a dozen lines on) left the tree inconsistent (lines linked into the wrong node, line counts taken off the wrong node, a node left with too few lines); the B-tree check (debug 1) aborted; release 2.03 too. Fixed: a block insert that emptied the B-tree node of its last line left that node's parent with too few children (the B-tree check aborted); the first ancestor left is rebalanced now. Fixed: the undo of a deletion lost the start of a tag that began inside a block of the deleted text and went on after it, when another tag was switched on and off later in the text (a temporary mark name was used twice); release 2.03 too. Fixed: the undo of a deletion of a block between two runs of a tag (which the deletion joined) gave the re-created block's head and tail the tag; release 2.03 too. Fixed: the undo of a deletion that dissolved a block and joined a run with a value in it to a later run of the tag put the value on the later run; release 2.03 too. Fixed: a deletion of nothing but the final newline that has only the selection on it set the modified flag (sel is not content). With -undo off, tag add and tag remove decide whether they modify from the state at the start of the range and the first toggle in it (no list of ranges is made any more). Fixed: the undo of a deletion re-created a block whose contents switch a tag off with its tail still carrying the tag (as at the place the block was made); release 2.03 too. 2.03 (2026-11-08): Values: a Perl scalar can be kept with every node of the tree of a block, the leaves included ("block nodedata index level ?value?", blockNodedata), with every mark ("mark data name ?value?", markData) and with every run of a tag ("tag data tagName index ?value?", tagData). The widget keeps a copy, and the values move with the text: where an edit joins nodes or merges runs the first value present wins, block split and a run cut in two leave the new part without one, a mark keeps its value through every move. A value is freed only when it is replaced, when its node, mark or run goes (or loses a join or a merge) and when the widget is destroyed, and then only when the widget command returns, the change finished, so that a DESTROY method may use the widget; the instance data of a block (block data) is now freed the same way. With -undo, a deletion keeps the values it drops in its undo step and the undo gives them back; edit reset, -maxundo, a new edit dropping the redo history and the widget's destruction free them. "block list" writes the node values of a block as a fourth element of its header, and the start of a run with a value as a TagOn holding [name, value] instead of a reference to the name (a program that reads TagOn as a scalar reference has to accept both; the demo's TeX export now does). The manual has a section "Values"; the known limits are in BUGS. New tests: t/values.t, t/values-marks.t, t/values-runs.t. Fixes found on the way: block insert inside a block, over a range spanning nodes of the block's tree, corrupted the tree (negative line counts, lines linked across nodes), and "get" then crashed; undo re-created the tags of a deletion inexactly (text put back inside a tagged range took the tag, as inserted text does, though it had not had it); undo re-created a block whose root has a single child one level too shallow (the depth in the header was ignored); a block dissolved by a deletion of its head or tail leaked its first internal line and its dummy line (about 140 bytes each time); eTextSyms.h was stale and left four symbols without the prefix; the manual gave 1 as the depth of a separator between leaves of the same parent, where it is 0; the message for a wrong block subcommand did not name "data". Crashes of block editing, found by random sequences of block editing and undo (all of them in 2.02 too; t/stress.t has a minimal script for each and a bounded random run): block split did not tell the display about its newline, which then read past the end of the line it had cut short (a segfault, typically in the undo that followed); block insert of an -empty block at the start of a line dereferenced NULL; block insert with its end before its start cut the text apart (now an error); deleting an -empty block inside a block took it off the block's length twice (the block lost its last character, and later panicked); a deletion inside a block that joined leaves of different nodes lost the tag counts of the lines it moved, and in the deletions that dissolve a block left a node without children (a segfault); a node merge while a block's line was changing counted the block's tags twice and left the tag's root on a freed node (a segfault); "block list", and so the undo record of a deletion, from just after a block reported an empty piece of it (the undo put a stray block in); the undo of a deletion could re-create a block on the last, dummy, line; an undefined index segfaulted (the parser wrote into the argument's string; it works on a copy now, as Perl/Tk's text does); with the B-tree check on, a deletion from the tail of a nested block panicked ("segment has size <= 0"). Undo: after "edit undo", "edit redo" or "edit reset" the next edit starts an undo step of its own; a deletion after the undo of a deletion used to join the step of the insertion before it, so a second undo took that insertion back as well (in 2.02 too). 2.02 (2026-11-07): Scrolling copies the visible lines with TkScrollWindow and redraws the damaged region, as Tk 8.4 does on every platform. The tk4.0 code used XCopyArea and then waited with XWindowEvent for GraphicsExpose/NoExpose; on Windows XWindowEvent is an empty stub in Perl/Tk, so the first scroll would have read an event that was never filled in (seen under Wine: 2.01 stops at the first scroll with "DisplayText received unknown exposure event"). Makefile.PL links -lX11 only outside Windows, and compiles with -Wall under gcc and clang (what it found unused is gone). Windows: built and tested under Wine with Strawberry Perl 5.38.2.2 and Perl/Tk 804.036 built there; all tests pass, given the Perl/Tk fixes in the repository's upstream/ (without them Perl/Tk 804.036 does not build with current mingw-w64, or crashes at its first update). The display line tests name a monospaced font (Courier) instead of relying on the default, which is Courier New on Windows. 2.01 (2026-11-07): The first release of the modernized distribution (the 2.00 entry below, the development history of the port, was never released under that number). The release layout: the user documentation (README.md, Changes, BUGS, doc/etext.pod) is inside the distribution; Makefile.PL declares the prerequisites (Perl 5.10, Tk 804.027, Test::More) and the metadata (CPAN META spec 2: license, repository, bug tracker; the bundled FreezeThaw and Text::TeX under utils/ are not indexed); the Tcl/Tk flavour of the sources is not shipped (it stays in the repository). Since the 2.00 entry was written: undo re-creates embedded images and windows; embedded windows inside blocks can be addressed by name and index; "display linestart", "display lineend" and "+N display lines", with Home and End on the display line (all described under 2.00 below). The reports for upstream (Perl/Tk, Tcl/Tk) are in upstream/reports/ of the repository, one file per report. 2.00 (2026-11, not released): The Perl extension (Tk::eText) made to build and work with today's Perl (5.38) and Perl/Tk (804.036): - standalone ExtUtils::MakeMaker/Tk::MMutil build against the installed Perl/Tk, no Tk build tree needed; loaded with XSLoader; all internal symbols prefixed (eTextSyms.h) so that they cannot clash with Tk's own text widget; - Tk-b9 "Lang" layer replaced by the Tk 804 API (Tcl_Obj arguments and results, Tcl_ListObjGetElements, Perl regexps via Tcl_GetRegExpFromObj, Tcl_ObjSetVar2 for -count); - XFontStruct/TkMeasureChars/TkDisplayChars replaced by Tk_Font, Tk_MeasureChars, Tk_DrawChars, Tk_UnderlineChars, with tab and newline handling done by the widget, as in Tk 8.4; - Tk::eText is a subclass of Tk::Text and gets all its bindings; the demo moved to demo/etext.pl and ported (Tk 804 has no Menubar with a command() method; option names need dashes; ornaments are Unicode characters now); - automated tests in t/ (t/basic.t, t/leak.t). Memory leaks fixed: - each call of the block layout callback leaked a reference to the widget (hence the widget's Perl object could never be freed); the cursor blink re-lays-out the line it is on, so with the cursor in a block this leaked twice a second; - TkTextRedrawRegion leaked an X region per call (focus change, expose); - "block list" leaked one scalar per call, and every typed element of the result leaked its payload; - the embedded-window element of "block list" leaked a widget reference. Other fixes: - search -nocase works for exact (non-regexp) searches (the lower-casing of the pattern had been disabled); - "block configure" default of -layoutdepth is -1, as documented; - "block data" is available as a method (blockData); - Tcl_IntResults with a single value aborts in Tk 804; replaced. Fixes after a review of the port (t/regress.t covers them): - "tag prevrange" crashed whenever the last toggle of the tag was not on the first line of its B-tree node (NULL dereference, or an index past the end of the line); the backward search is reworked: only lines of the outermost tree count against its line budget, it leaves a block into the enclosing line, and compares the stop position with external offsets. Verified against "tag ranges" for every index/stop position in a dozen block layouts. (Where Tk's own text widget returns a range starting before index2, contrary to its documentation, eText follows the documentation.) - "search -nocase": the lower-casing of the extracted line wrote through a pointer taken before the buffer was appended to (which reallocates it under Perl/Tk): heap corruption on any line longer than the initial buffer. - A layout callback returning a single row (all an -empty block needs) was rejected ("List of wrong size"). - "block delete" / widget destruction did not release the block's callbacks and -layoutwidths (a -layoutcmd closure kept the widget alive); tag -data was never released; "dump -command" given twice leaked the first callback; "block list" could leak a pending value before an embedded window, and returned the block instance data by alias (modifying the result modified the block). - "window cget -align" died with "Modification of a read-only value" (and printed "centre" for "center"); "tag bind" queried without a binding croaked with an empty message; "dump" read past the argument vector when the last argument began with "-"; "search -nocase" leaked the pattern copy on an invalid index. - A display line too narrow for one character split a multi-byte character (whole UTF-8 characters are forced now, as in Tk 8.4). - Build: MakeMaker ran eTextSyms.PL during every "make" and, on a fresh checkout, replaced the symbol-prefix header by an empty one (so the next build would have clashed with Tk's text widget); the script is no longer run automatically, is idempotent, and refuses to write an empty header. One uncast allocation that GCC 14 rejects. Dead Tcl-only compatibility macros removed. - editXxx/imageXxx methods now reach the explicit "not implemented" message; the demo honours $ENV{kprefix}; POD file references. Features of the modern Tk text widget, added later in 2.00 (each with a test that compares the behaviour with Tk's own text widget on the same text where that is possible): - text indices count characters, not bytes (Perl/Tk 804 stores text as UTF-8): the Tk 8.4 design - byte offsets inside, the conversion at the "line.char" boundary - extended to count into blocks (the dummy position at the start of a block is one character); search -count and -nocase, dump, "block of", bbox, wordstart/wordend follow. A match inside a block was reported one position too far (TkIBTreeTextAppend). t/utf8.t. - the -elide tag option: hidden text takes no room, inside blocks too (a hidden block disappears, hidden text inside a block narrows it). search does not skip elided text. t/elide.t. - the image subcommand (embedded images, Tk 8.4's tkTextImage.c); images work inside blocks and appear in "block list" as Tk::Text::EmbImage; "dump -image" reports the image's name in the widget, as documented. t/image.t. - the edit subcommand (undo, redo, reset, separator, modified), -undo, -maxundo, -autoseparators, <>; the stack (tkTextUndo.c) records the changes themselves and the widget applies them with its own procedures. The text of a deleted block comes back as text when undone. <> and <> are bound. (Perl/Tk's Tk::Text records nothing: "edit undo" there always says "nothing to undo".) t/edit.t. - the demo's TeX symbol tables (utils/Text/TeX.pm) give Unicode characters instead of codes in 8-bit X11 symbol fonts, with reverse maps (%char2tex, %tex_by_char) for the TeX export; the sample document demo/save.tsf is converted; Save/Load use UTF-8. t/tex.t, t/demo.t (which drives the demo under X). Fixes and additions after that: - "tag nextrange" missed a range starting at index1 inside a block (it looked for the on-toggle in the outer line); the forward tag search compared a stop position inside a block with internal offsets (TkBTreeNextTag, the "XXXX Wrong" of 1997); TkTextRedrawTag handed internal indices to the display-line search. t/regress.t sweeps nextrange over the block layouts too (6,456 queries). - search leaves elided text out unless -elide is given, and so does the selection, as in Tk 8.4 (the line extraction skips elided segments and blocks under TKT_GET_NOELIDE); search -count counts the characters of the matched text. - "+N lines" keeps the character position (Tk keeps the byte offset, TK_BUGS.md A5). - dump looks into blocks: the elements inside a block are reported with external indices, between "block" and "blockend" elements (the -block switch, part of -all). t/dump.t. - undo re-creates the blocks (leaves, nesting, instance data), tags and marks of a deleted range that does not cut a block, from what "block list" reports, with the tag toggles where they were; a deletion that cuts a block (which the widget dissolves) comes back as text; windows and images are not re-created. "block data" accepts the start position of an empty or top-level block. The demo has -undo on: Control-z undoes, formulas included. - TK_BUGS.md: A4 (search -nocase and case-changing lengths), A5, B6 (booleans), C4 (Tk::Text's undo records nothing), C5 (dump -image), D5. The next batch: - undo of a deletion that cut blocks re-creates them. Such a deletion is recorded as the "block list" of the smallest range around it that cuts no block, with the size of what the dissolution of the cut blocks leaves behind (TkIBTreeCutRange); the undo takes those remains out and re-inserts the list, redo repeats the original deletion. Found on the way: a right-gravity mark in a re-created range drifted to the end of the insertion (text inserted at an index goes before the right-gravity marks there; such marks get their gravity back only at the end now); deleting all of a block but its head, or all but its tail (which deletes the block, as documented), crashed: TkBTreeKillBlockProc freed the lone newline of an emptied block while the outer line still linked to it, and TkBTreeDeleteChars rebalanced from a line of the destroyed block. t/edit.t (a dozen layouts: the text, "dump -all" and the block list before and after), t/regress.t. - the "display" and "any" index modifiers of Tk 8.5: "+N display indices" (or chars) steps over elided text, "display wordstart" and "display wordend" see the visible characters only ("any" means the plain modifier; "indices" is accepted as a synonym of "chars"). The widget's cursor keys (Left, Right, Home, End, the word keys, the Emacs ones) use them, so the insertion cursor skips elided text, as in Tk 8.5, where Tk::Text's can sit in it. Tk 8.6's "display wordend" walks into elided text (TK_BUGS.md A6); etext's does not. t/elide.t (every position of a text with elided ranges, compared with wish if it is installed; blocks; the keys). - undo re-creates embedded images and windows (Tk's text widget restores neither): the Tk::Text::EmbImage and Tk::Text::EmbWin elements of "block list" carry the options as option/value pairs, and the undo creates the segment again through the image or window command. An image whose Tk image is gone comes back empty; a window given with -window was destroyed with the deletion (as in Tk) and comes back as an empty window segment, one with -create is created again when displayed; either way the segment keeps its unit of index space, so the recorded indices of the other changes stay right. This covers images and windows among the remains of a cut block. t/edit.t. - an embedded window inside a block can be addressed by name and by index: "index" by the window's name gave the position inside the block, and "window cget"/"window configure" could not find the segment there. t/regress.t. - "display linestart", "display lineend" and "+N display lines" (Tk 8.5): the display line containing an index is found by laying the logical line out from its start; "display lines" keeps the x position, as the Up and Down keys do, passes over entirely elided lines and stops at the last display line of the text (Tk 8.6's answer past the end depends on the x position, TK_BUGS.md A7). Display lines never span logical lines here: a line whose newline is elided still ends a display line (Tk 8.5 merges it with the next one; the answers differ only around an elided newline), and the widget wraps as Tk 8.4 does (a space at the right margin needs a pixel of room, Tk 8.5 lets it hang over). Home and End go to the first and the last visible position of the display line (Tk 8.5). t/elide.t: every position of a wrapped text with elided ranges compared with wish 8.6.14 for display linestart, lineend and -2..2 display lines (1126 queries), after checking that the two wrap alike. Alpha3: Empty blocks implemented, minor bugs and documentation corrections. 0.4: Too many. (Some of these could be present in ALpha3 too). New style of horizontal offset added. New interface for layoutCmd added. 3 styles: 1 element, 7 elements, 13 elements (last ones recognized, but not supported). New style of addline and deletelines. Works with Perl. First argument to layout callback now contains widget name too. Used in Equation to get width of the screen. Deletion works better, now deletes as deep a split as needed. 0.4.1: Now patches one file in Tk only. Now recompile of Tk should be _very_ quick (reinstall can be slow). 0.4.2: One file was (erroneously) a link outside the tree. The rest of links should be corrected. 0.4.3: A warning for missing file busted the test on different sites. 0.4.4: (Under Perl:) Now the second component of the first argument of layoutCallback is not the name of the widget, but actual reference to the widget. However, a patch to tkGlue.c is needed. Not released because of this. 0.4.5: One minor bug corrected, updated to sync with Tk-b8 and tk4.0p1. No recompile of Tk is necessary. 0.4.6: Selection bug corrected, Tab works again (ListFactoryAppendList added), environment variable `kprefix' denotes prefixes for special keys (default `Control-Meta-'). 0.4.7: Hidden leaves where not hidden from BBox and Measure. Perl demo updated (now only the pedestal is missing). Doc brushed up by Norm Shelley. 0.5.0: Selection and search work. `txtWgt config -getFlags 1' works. 0.5.1: Note that case conversion during extraction works with DStrings only. Verbose mode works, making it possible to have Load/Save in Perl demo. Temporarily verbose output is put on 'block list' subcommand. Menubar added to Perl demo. (TeX from selection is not working so far). Minimal TeX import added. 0.5.2: Minor documentation fixes. Table block coded in Perl demo. Algorithm of finding @x,y may return start and end of a block now. One could not render a block with data. Block insertion could eat the last fake line into block. Makefile.PL (for Perl build) updated for Tk-b10-tobe. 0.5.3: Warning from gcc -Wall -Wno-comment -Wno-unused corrected. MarkFindPrev need additional work: there are two modes for going out of tree: when we did not reach the target position, and when we did. TkIBTreeLastLine??? TagRootPtr... TkBTreeStartSearch TkBTreePrevTag Methods.def manually created. 0.6.1: Bug with tags togglecount when going out of IBTree corrected. Cleaned up Makefile.PL (might break the install if inside Tk tree). 0.6.2: Should work inside Tk directory too.