Re: [code] Disabling auto-complete boxes and bracket matching in comments

From: Mitchell <m.att.foicica.com>
Date: Tue, 10 Dec 2013 11:27:30 -0500 (Eastern Standard Time)

Hi Rob,

On Mon, 9 Dec 2013, Rob Kendrick wrote:

> I've hunted for what seems hours (about 4 minutes) and cannot find a way
> of disabling the autocomplete and bracket/quote matching in comments.
> Is there a way of doing this that I've missed?

Not fully tested, but you want to connect to the `events.CHAR_ADDED` event
to "undo" the added character when you're within a comment:

     events.connect(events.CHAR_ADDED, function(c)
       local M = textadept.editing
       if not M.AUTOPAIR then return end
       local match = (M.char_matches[buffer:get_lexer(true)] or
                     M.char_matches)[c]
       local style = buffer.style_at[buffer.current_pos - 2]
       if match and buffer.selections == 1 and
          buffer.style_name[style] == 'comment' then
         buffer:clear()
       end
     end)

Cheers,
Mitchell

-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Tue 10 Dec 2013 - 11:27:30 EST

This archive was generated by hypermail 2.2.0 : Wed 11 Dec 2013 - 06:49:53 EST