Re: [textadept] TextAdept and ProFont

From: mitchell <c....at.caladbolg.net>
Date: Wed, 17 Nov 2010 12:13:04 -0500 (Eastern Standard Time)

Jonas,

> Thanks
> Last question : is it possible to add new keyword classes (I guess
> they are called tokens in TA) ? I'm asking because I see:
> -- * `DEFAULT`
> -- * `WHITESPACE`
> -- * `COMMENT`
> -- * `STRING`
> -- * `NUMBER`
> -- * `KEYWORD`
> -- * `IDENTIFIER`
> -- * `OPERATOR`
> -- * `ERROR`
> -- * `PREPROCESSOR`
> -- * `CONSTANT`
> -- * `VARIABLE`
> -- * `FUNCTION`
> -- * `CLASS`
> -- * `TYPE`
> as default token types, but I don't know if it's possible to add new
> one without going through lpeg...

You would be modifing the lexer in question by adding tokens and
specifying styles for those tokens.

local casts = token('cpp_casts', word_match { 'const_cast',
'dynamic_cast', 'reinterpret_cast' })

-- other code ...

_tokenstyles = {
   { 'cpp_casts', l.style_keyword..{ fore = colors.teal }
}

See the lexer LuaDoc for more info.

mitchell

>
> On Wed, Nov 17, 2010 at 17:04, Robert <ro....at.web.de> wrote:
>> On Wed, Nov 17, 2010 at 12:11 PM, Jonas O. <ezjo....at.gmail.com> wrote:
>>> In fact I wanted to ask about brace highlighting, not brace matching;
>>> the way the corresponding braces highlights when the caret is next to
>>> a brace, not the keyboard short that make the caret go to the other
>>> brace.
>>
>> The snippet I linked to does both - change the default highlighting of
>> Textadept to the way Scite does it (highlight matching braces before
>> and after a caret) and allow to go there with a keyboard short cut.
>>
>>>
>>> Other question: is it possible to fold all block, or all blocks of a
>>> certain "level" (like notepad++, sorry) ? Did somebody already do that
>>> ?
>>>
>> There is some folding code on the wiki. To get what you describe you
>> could loop through all lines, check the indentation level and fold if
>> necessary.
>> To get the current indentation of a line you need something like this:
>> local line = buffer:line_from_position(buffer.current_pos)
>> local indentation = buffer.line_indentation[line]
>>
>> Robert
>>
>> --
>> You received this message because you are subscribed to the Google Groups "textadept" group.
>> To post to this group, send email to textadept.at.googlegroups.com.
>> To unsubscribe from this group, send email to textadept+unsubscribe.at.googlegroups.com.
>> For more options, visit this group at http://groups.google.com/group/textadept?hl=en.
>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups "textadept" group.
> To post to this group, send email to textadept.at.googlegroups.com.
> To unsubscribe from this group, send email to textadept+unsubscribe.at.googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/textadept?hl=en.
>
>

mitchell
Received on Wed 17 Nov 2010 - 12:13:04 EST

This archive was generated by hypermail 2.2.0 : Thu 08 Mar 2012 - 11:53:55 EST