Clearing the Widget

pathName clear

This command is clearing the overall widget, this affects all the characters, soft hyphens, embedded images, embedded windows, tag information, and marks. This is not bounded by restrictions, given with option -start/endindex. Also the undo stack will be cleared. It's like a reset to the initial state, without resetting the options of the widget, and without clearing widget bindings. Also the states edit modified, edit altered, and edit irreversible will be resetted to false. The widget now will be overall clean (see command isclean -overall). Note that this operation cannot be undone.

Clearing the text widget (not only the text content, also the tags should be cleared, if the next fill will use a different tag set) is quite slow and inconvenient, example:

Now this is much simpler, and more than 100x faster if many tags are in usage, furthermore it's a complete reset (except the unaffected widget options and bindings):

Note that clearing the text widget is also accelerating the widget when the text content will be completely exchanged, especially if many features like tags, marks, etc., are used. The next fill is as twice as fast in some cases, even if the next fill is using the same tag information.

Also note that clearing the widget is doing an overall clear, but the statement [.t delete 1.0 end] is only clearing the content inside the specified ranges (given with options -startindex, -endindex; or -startline, -endline). This means that in general the new command clear has no alternative; with other words, clear provides a new functionality, it's not only a shortcut.