Version 33 of Ctext

Updated 2006-06-21 08:41:46

Documentation at http://tcllib.sourceforge.net/doc/ctext.html

Ctext is

  • part of tklib.
  • a megawidget that is built upon the Tk text widget. It provides syntax highlighting, and can be used to highlight a variety of languages. It provides a simple API and more radical changes (other than color) can be made by modifying the tag attributes. By default matching pairs of characters are flashed on the screen, like the popular Emacs and Lisp editors can do.
  • licensed like Tcl (BSDish), but copyrighted

 What: custom text widget
 Where: http://tcllib.sf.net/ (within the tklib module)
 Description: Fast syntax highlighting text megawidget.
        Provides a way to control the highlighting colors for classes
        of keywords.  Latest version has electric braces/quotes/brackets
        and a new edit modified instance command.
        Has been tested with Tcl/Tk 8.3.2 and 8.4b1.
 Updated: 05/2004
 Contact: tklib maintainers

RLH - I just looked at the docs (which I somehow missed before). What a great widget!

AK: The docs were actually added last week, so you could not find them before.

KJN: Thanks for the docs. In case anyone else is looking, they were added to CVS on 2005-04-08, and are not yet in a released version of Tcllib. See the link at the top of the page for the HTML version.


TR: A real-life example using ctext and BWidget for interactive debugging and introspection is here: a debugger with syntax highlighting using ctext


MSH: 2006-05-05 I have just discovered a major drawback with Ctext. Using the linemap to display linenumbers all works OK till I change the size of the font used (I have highlighting using 4 fonts, normal, bold, italic and bolditalic). When the font increases (CTRL-Mousewheel), the numbers no longer line up !! After investigation I found that the -linespace font metrics is not identical for a given point size on all four fonts !! I am working on a proc to adjust the sizes of the fonts individually to maintain a nominal linespacing UNLESS someone knows better ? ;-)


MSH: 2006-06-21 Me again, Font resizing is implemented but under linux the fixed fonts are reeealy ugly when scaled up. I have since discovered another problem, I have an application which uses two text widgets one for a help system with images and another with a fixed font line numbered ctext widget. I saw that the text widget of 8.5 does pixel scrolling with images so I repacked with 8.5a2 and the help is ok but now the fixed text can scroll by a few pixels and the line numbers no longer line up !! Is there any way to force the new text widget to only scroll by whole text lines ? or has someone found another way to update the numbers in ctext ?


[ Category Package | Category Widget Category GUI, a part of tklib | Category tklib ]