Re: [code] [textadept] API changes

From: Robert Gieseke <>
Date: Sat, 30 Nov 2013 17:24:22 +0100

Am 11/28/13, 4:21 AM, schrieb Mitchell:
>>>> * An annotation function
>>>> Many language modules have an annotation function to show syntax
>>>> errors. A centralised function would avoid writing this again in every
>>>> module and could more easily be customized in behaviour. I find these
>>>> annotations very helpful but I would prefer to never have my caret
>>>> position changed, like already implemented in the Python module[2]
>>>> (but not in the Lua module for example).
>>> I think this is a good idea, without jumping the caret.
>> Would you like to see a patch? In case there are different preferences
>> for this feature it might be an option to have this handled by an
>> event, otherwise an 'annotate_line' function might be enough -- but I
>> don't know
> Sure, that would be great.
I thought it could just look like

function annotate_line(line, msg, style)
   if not style then style = 8 end -- error style number
   -- If the error line is not onscreen, annotate the current line.
   if (line < buffer.first_visible_line or
       line > buffer.first_visible_line + buffer.lines_on_screen) then
     msg = 'line '..(line + 1)..'\n'..msg
     line = buffer:line_from_position(buffer.current_pos)
   buffer.annotation_visible = 2
   buffer.annotation_text[line] = msg
   buffer.annotation_style[line] = style

but noticed that when scrolling the caret out of view jumping to the
annotation might be actually useful. Maybe I need to experiment a bit
more with this.

- Robert

You are subscribed to
To change subscription settings, send an e-mail to
To unsubscribe, send an e-mail to
Received on Sat 30 Nov 2013 - 11:24:22 EST

This archive was generated by hypermail 2.2.0 : Sun 01 Dec 2013 - 06:52:49 EST