laurentpetit/ccw — pull request #30 by fmjrey (2014-04-12 19:28:41+00:00)
Title: REPL log panel now uses the LineStyleListener approach for styling.

The StyledText widget offers two mutually exclusive ways for handling
line styling:
- style range methods, which store styles in the widget,
- LineStyleListener(s) that return styles whenever required.
Previously the first method was used, preventing the use of
LineStyleListeners unless one wants to override CCW styling.
By switching to the LineStyleListner approach, it's now possible for
other CCW components and plugins to participate in styling by adding new
listeners.
This change requires the caching of line styles because there is no
point in recomputing the style for text that does not change.

Rather than trying to use an interval tree in java or clojure, and add logic for merging styles, the existing logic from eclipse has been duplicated and adapted, making this transition quite easy.

I've been testing this change and it seems to be working fine.
It's also interesting to see it at play with the [ANSI REPL plugin](https://gist.github.com/fmjrey/9889500).
I've made a new version of that plugin which adds a button on the REPL toolbar for enabling/disabling ANSI escape code processing. Without this change, styling done by CCW is completely lost once ANSI support is enabled on a REPL. With this change, once can easily switch from one to the other.