TIP 466: Revised Implementation of the Text Widget

Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2017 Conference, Houston/TX, US, Oct 16-20
Send your abstracts to tclconference@googlegroups.com
by Aug 21.
Author:         Fran├žois Vogel <fvogelnew1@free.fr>
Author:         Gregor Cramer <remarcg@gmx.net>
State:          Draft
Type:           Project
Vote:           Pending
Created:        10-Mar-2017
Post-History:   
Keywords:       Tk,text widget
Tcl-Version:    8.7

Abstract

This TIP proposes the replacement of the current implementation of the text widget (the "legacy" text widget) by a revised implementation offering a large number of advantages.

Rationale

The Tk text widget has become increasingly complex as long as incremental improvements and features have been added from time to time. In that process, some known long-standing issues have become very difficult to tackle, for instance the long line problem regarding lack of performance.

Gregor Cramer, in the process of using the text widget in one of his applications, has analyzed the issues the current text widget is suffering from, and has come up with a new implementation having the following main advantages:

Proposal

The proposal is to replace the legacy code with the new implementation.

The author of the revised implementation has written a well documented website http://scidb.sourceforge.net/tk/revised-text-widget.html describing in details the issues with the legacy code, how he fixed these issues, and what features he has changed or improved.

It was not deemed feasible nor necessary to copy/paste/reformat all the information of the above website into the present TIP. Only the new features and incompatibilities are highlighted here, as opposed to detailed rationales about each change.

A version of the text man page, consistent with the changes and improvements proposed by the present TIP, can be seen at http://scidb.sourceforge.net/tk/text.html This version of the man page is colorized, with blue meaning "changed", and green meaning "new", so that it is easier to spot what's different from the legacy text widget.

Performance Improvements

Detailed performance comparison between legacy code and revised code can be found at http://scidb.sourceforge.net/tk/comparison.html but these are the key points:

New Features

Detailed explanations and rationales for each of the items below can be found at http://scidb.sourceforge.net/tk/revised-text-widget.html

Bug Fixes

Details on each of these bugs can be found in the "Bugs/Issues in Original Implementation" section at http://scidb.sourceforge.net/tk/revised-text-widget.html

Incompatibilities with Legacy Version

Based on the author's website, the following incompatibilities are currently known:

Deprecated Commands and Options

Drawbacks

Detailed memory comparison between legacy code and revised code can be found at http://scidb.sourceforge.net/tk/comparison.html

Known Issues in the Revised Implementation

Based on the author's website, currently only these issues are known:

Also, the following should be noted:

Miscellaneous

Target Release

Given the amount of changes, also because of our usual precautions regarding backwards compatibility, and despite the very high quality of the code and the fact it passes (almost all) the previously existing test suite, it is deemed reasonable to target Tcl/Tk 8.7 (or 9.0), but neither the 8.6 nor the 8.5 streams of releases, which will continue to implement the legacy text widget code.

Support of versions back to 8.5 is currently included in the revised code, but will be removed (because it's useless for use in trunk only) at the time the new code will get merged into trunk.

Implementation

Implementation of the revised text widget code has been placed in branch http://core.tcl.tk/tk/timeline?r=revised_text of the fossil repository.

This implementation compiles on Linux, Windows, and OS X. It respects the standards of Tk (C99 standard, and also the Tcl source code formatting described in [247]).

The man page for the text widget has been contributed by jima and is included in the revised_text branch.

The expected results of many tests were adjusted to take into account that the revised implementation is better optimizing, so some trace results of display line computation are different. Other adjustments were required because of bug fixes.

Open Questions

Copyright

This document has been placed in the public domain.

The author of the revised text widget code has explicitly placed his code of the text widget under the same license as Tcl.

History