Re: [code] Re: Debugging language modules

From: Mitchell <m.att.foicica.com>
Date: Sun, 27 Mar 2016 19:19:59 -0400 (EDT)

Hi Arnel,

On Sun, 27 Mar 2016, Arnel wrote:

> On Sat, 26 Mar 2016 14:41:49 -0400 (EDT), Mitchell <m.att.foicica.com> wrote:
>> Hi Arnel,
>>
>> On Sun, 27 Mar 2016, Arnel wrote:
>>
>>> Hey Robert,
>>>
>>> On Sat, 26 Mar 2016 17:20:23 +0100, Robert Gieseke <rob.g.att.web.de> wrote:
>>>
>>>> On Sat, 26 Mar 2016, Arnel wrote:
>>>>
>>>>> - Is it possible to change the background color of highlighted
>>>>> brackets and parentheses when looking for their pairs? There doesn't appear to
>>>>> be anything related mentioned in the buffer API for it.
>>>>
>>>> In your properties.lua file you can overwrite Textadept's defaults, this
>>>> gives me a red box (with Solarized theme):
>>>>
>>>> local INDIC_BRACEMATCH = textadept.editing.INDIC_BRACEMATCH
>>>> buffer.indic_style[INDIC_BRACEMATCH] = buffer.INDIC_FULLBOX
>>>> buffer.indic_fore[INDIC_BRACEMATCH] = buffer.property_int['color.base08']
>>>> buffer:brace_highlight_indicator(not CURSES, INDIC_BRACEMATCH)
>>>>
>>>> (I use a base16 theme, so you might not have other colors defined, you
>>>> could also specify a color directly.)
>>>
>>> Thanks. I got there by:
>>>
>>> local INDIC_BRACEMATCH = textadept.editing.INDIC_BRACEMATCH
>>> buffer.indic_style[INDIC_BRACEMATCH] = buffer.INDIC_ROUNDBOX
>>> buffer.indic_fore[INDIC_BRACEMATCH] = property_int['color.cyan']
>>> buffer.indic_alpha[INDIC_BRACEMATCH] = 100
>>> buffer.indic_outline_alpha[INDIC_BRACEMATCH] = 50
>>>
>>> Setting the buffer.indic_alpha and buffer.indic_outline_alpha adjust the
>>> opacity. However, it's too bad there's no complement 'buffer:indic_back'
>>> table to allow, for example, simply reversing the foreground/background colors
>>> which is usually the case with other editors with similar bracket-matching
>>> features. As it is now, both the bracket itself *and* the background color
>>> *and* the outline are colored the same.
>>>
>>> Perhaps a feature request sometime in the future?
>>
>> There are two ways to highlight braces: either using indicators or
>> using styles. The GUI version uses indicators and the terminal version
>> uses styles. It sounds like if you want to use foreground and background
>> colors exclusively (no decorations like the default box), then you should
>> go the styles route. Take a look at the "term.lua" theme:
>>
>> property['style.bracelight'] = ...
>>
>> You'll want to put a version of that in your theme or in your
>> `~/.textadept/properties.lua`. (If the latter, make it `buffer.property
>> ...` -- note the 'buffer.' prefix.)
>>
>> Then in `~/.textadept/properties.lua`:
>>
>> buffer:brace_highlight_indicator(false, 0)
>>
>> That will turn off the indicator and use the style you defined.
>>
>> Cheers,
>> Mitchell
>
> Other than the fact I need to add that one line to 'properties.lua', this is
> brilliant. :)
>
> It would make the theme easier to use if I could incorporate that line into the
> theme file itself and just ask the user to drop the file into
> '~/.textadept/themes', but I will take what I can get and just advise the user
> to do the same in the README file.

Technically you can put that one line into the theme itself -- both theme
code and properties.lua code are run right around the same time. I just
separated them with respect to logical grouping.

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 Sun 27 Mar 2016 - 19:19:59 EDT

This archive was generated by hypermail 2.2.0 : Mon 28 Mar 2016 - 06:54:06 EDT