Additional Command 'edit info'

pathName edit info ?array?

Stores an array of some edit information in given variable array, if array is not given then an unnamed variable will be used.

This command returns the array name array, or an empty string (unnamed variable) if array is not specified.


This is the available information related to this widget:

bytesize

Current byte size, only characters have been counted (a character may have more than one byte).

lines

Current number of lines.

visibleimages

Number of visible embedded images.

visiblewindows

Number of visible embedded windows.


This is the available information related to whole content:

totalbytesize

Current byte size, only characters have been counted (a character may have more than one byte).

undodepth

The depth (number of undoable actions) of the undo stack.

redodepth

The depth (number of redoable actions) of the redo stack.

undostacksize

Current number of items on undo stack.

redostacksize

Current number of items on redo stack.

undobytesize

Current number of bytes on the undo stack, only characters have been counted (a character may have more than one byte).

redobytesize

Current number of bytes on the redo stack, only characters have been counted (a character may have more than one byte).

undocommands

If the current undo stack action does not contain an undo atom, then this information is empty. Otherwise it contains the list of commands that have been pushed for undoing onto the stack since last inserted separator. A command is one of: delete, image, insert, mark, tag, or window. Note that mark can only occur when option -steadymarks is enabled. Also note that the replace command is pushing either delete and insert. Further note that this list contains all edit operations of the current undo atom, this means that some commands can occur repeatedly.

redocommands

If the current undo stack action does not contain an redo atom, then this information is empty. Otherwise it contains the list of commands that have been undone with current undo command, see undocommands for more details.

totallines

Current number of lines.

images

Number of embedded images.

windows

Number of embedded windows.

tags

Number of currently defined tags.

usedtags

Number of tags currently used.

marks

Number of currently defined marks, this does not include the special marks insert and current, nor the generated marks (see mark generate).

generatedmarks

Number of generated marks currently defined (see mark generate).


This information is unrelated to the content:

linespernode

Minimal number of lines per node in B-Tree, this information is only useful for testing.


In the future the information might be extended. Note that embedded windows and images will each be count with byte size one.

Note: recently the Tk team has added the commands edit undodepth and edit redodepth. But these commands are not yet belonging to the distributed Tk standard, and the edit info command is more flexible, so I did not integrate the additions edit undodepth and edit redodepth. The recently added commands edit canundo, and edit canredo are marked as deprecated in revised version, because edit info also provides this information. And in this way, with the edit info command, the flooding with new commands will be prevented. The edit info command is flexible and extensible.

The virtual event <<UndoStack>> has been adopted into the revised version, but this event now will be triggered with any change on the undo stack, because [set [.t edit info](undocommands)] and [set [.t edit info](redocommands)] will provide the changed content.