Re: [code] [textadept] Styling changes

From: Robert Gieseke <>
Date: Sat, 22 Nov 2014 11:02:29 +0100

Hi Mitchell,

Am 20/11/14 um 21:29 schrieb Mitchell:
> Okay, thanks. I thought that revision might be what is causing it.
> Some background: Scintilla keeps track of the last correctly styled
> position via `buffer.end_styled`. When a character is added to a line,
> Scintilla usually rolls back `buffer.end_styled` to the beginning of the
> line typed on and then calls on the lexer to style from that point
> forward.
> Prior to the change you pointed to, Scintilla didn't perform any styling
> at all if the current lexer had no grammar, thus keeping the value of
> `buffer.end_styled` at 0 (and keeping any user-applied styles). However,
> this kept telling the lexer to re-style everything starting from zero,
> which seemed inefficient (hence the change). In order to set
> `buffer.end_styled` and prevent the same text from being lexed again and
> again, I simply style all of that text in the default style. The side
> effect is what you're seeing: any existing styles are overwritten. The
> question is: how and when are you applying your styles? Is it possible to
> re-apply your styles at the right time? If not, perhaps it's worth
> reverting the change.

Thanks for the explanation, I can workaround the issue by always
applying a (default) style if none is given in Textredux' `add_text`

What happens in `list.lua` when adding new columns is basically this:

keys.c4 = function()
  local buffer = buffer
  buffer:start_styling(0, 0xff)
  buffer:set_styling(20, 4)
  buffer:start_styling(5, 0xff)
  buffer:set_styling(20, 4)
  buffer:add_text(' ')

The last line triggers the 'un-styling'. (For the list this would be
adding unstyled padding to the list items.) I'm fine with my workaround
but I'm not sure if similar unstyling could happen for example with a
spell checker: an error is highlighted in a line, char is added at the
end of the line, styling at the beginning would be removed.



You are subscribed to
To change subscription settings, send an e-mail to
To unsubscribe, send an e-mail to
Received on Sat 22 Nov 2014 - 05:02:29 EST

This archive was generated by hypermail 2.2.0 : Sat 22 Nov 2014 - 06:39:48 EST