Re: [code] Re: Debugging language modules

From: Mitchell <m.att.foicica.com>
Date: Mon, 28 Mar 2016 22:24:42 -0400 (EDT)

Hi Arnel,

On Tue, 29 Mar 2016, Arnel wrote:

> On Mon, 28 Mar 2016 09:05:50 -0400 (EDT), Mitchell <m.att.foicica.com> wrote:
>> Hi Arnel,
>>
>> On Mon, 28 Mar 2016, Arnel wrote:
>>
>>> On Sun, 27 Mar 2016 19:19:59 -0400 (EDT), Mitchell <m.att.foicica.com> wrote:
>>>> 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.
>>>
>>> Hi Mitchell,
>>>
>>> I actually tried it before I sent that reply - it does not work. I even placed
>>> the 'buffer:brace_highlight_indicator()' line just after the 'local buffer =
>>> buffer' line at the top.
>>>
>>> (As an experiment, I tried setting the status bar text from both
>>> 'properties.lua' and the theme file. Turns out the status bar text from
>>> 'properties.lua' gets printed out, and the one from the theme file never
>>> gets printed on the status bar.)
>>>
>>> No worries, I've added this to the "no-syntax-highlighting" theme's README file
>>> along with Robert's snippet suggestion on making string highlighting
>>> toggle-able.
>>
>> Yes, you are right. I forgot that after running the theme file, Textadept
>> runs its own internal "properties.lua" which sets the brace highlight
>> indicator setting. That would obviously override anything you set in the
>> theme. Sorry for the noise.
>
> No apologies needed. Maybe consider it a feature request for another time? :)

Sure, the fact that I'm getting confused with these files indicates that
perhaps some changes are in order down the road :) We shall see.

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 Mon 28 Mar 2016 - 22:24:42 EDT

This archive was generated by hypermail 2.2.0 : Tue 29 Mar 2016 - 06:54:40 EDT