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

From: Rob Kendrick <rjek+foicica.com.att.rjek.com>
Date: Tue, 10 Dec 2013 16:41:59 +0000

On Tue, Dec 10, 2013 at 11:27:30AM -0500, Mitchell wrote:
> 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)

Great, ta. I'll give this a whirl.

B.

-- 
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:41:59 EST

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