Re: [code] [textadept] Column position displayed on status bar

From: Qwerky <mr.qwerky.att.gmail.com>
Date: Thu, 11 Jul 2019 10:32:06 -0600

Oh, I see, correction below!

On 2019-07-11 10:25, Qwerky wrote:
>
> Hi,
>
> On 2019-07-11 07:53, Mitchell wrote:
>> Hi,
>>
>> On Wed, 10 Jul 2019, Qwerky wrote:
>>
>>> Hi,
>>>
>>> On 2019-07-10 17:00, Mitchell wrote:
>>>> Hi,
>>>>
>>>> On Wed, 10 Jul 2019, Qwerky wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> On 2019-07-10 15:49, Mitchell wrote:
>>>>>> Hi,
>>>>>>
>>>>>> On Wed, 10 Jul 2019, Qwerky wrote:
>>>>>>
>>>>>>> Hello again,
>>>>>>>
>>>>>>> The status bar displays the current column position using
>>>>>>> 'buffer.column[pos]
>>>>>>> + 1', which is fine most of the time.  However, when the caret
>>>>>>> is in
>>>>>>> virtual
>>>>>>> space, the status bar displays the last column containing text,
>>>>>>> rather
>>>>>>> than
>>>>>>> the actual current column.  (Just type a letter, and the status
>>>>>>> bar will
>>>>>>> update to the current column.)
>>>>>>>
>>>>>>> Is there a variable like the one above which may be referenced,
>>>>>>> or a
>>>>>>> function
>>>>>>> which may be called, to return the actual current column number
>>>>>>> even
>>>>>>> when
>>>>>>> within virtual space?
>>>>>>
>>>>>> I'm looking at the Scintilla documentation[1], but not finding
>>>>>> anything.
>>>>>> This is probably a good question for the scintilla-interest
>>>>>> mailing list.
>>>>>>
>>>>>> Cheers,
>>>>>> Mitchell
>>>>>>
>>>>>> [1]: https://scintilla.org/ScintillaDoc.html
>>>>>> [2]: https://groups.google.com/group/scintilla-interest
>>>>>
>>>>> Okay.  Just before doing that, one more question.  SciTE does
>>>>> display the
>>>>> actual column in the status bar, as desired, so it does seem to be
>>>>> possible.
>>>>> In the Scintilla documentation I found the function
>>>>> 'SCI_GETCOLUMN'; I
>>>>> don't
>>>>> know whether or not this is the function used by SciTE (or is this
>>>>> the
>>>>> function used by Textadept)?  :-)
>>>>
>>>> `buffer.column[pos]` calls `SCI_GETCOLUMN`. You'll probably have to
>>>> play
>>>> around with it if SciTE indeed does what you expect.
>>>>
>>>> Textadept has a Lua interface to Scintilla. Check out the `buffer`
>>>> documentation[1]. Generally, separate words with underscores, use
>>>> `buffer:name()` notation for non-get/set messages, and use
>>>> `buffer.prop`
>>>> notation for get/set messages.
>>>>
>>>> Cheers,
>>>> Mitchell
>>>>
>>>> [1]: https://foicica.com/textadept/api.html#buffer
>>>
>>> Okay, I've posted on the Scintilla list.  But I'm having trouble
>>> trying to
>>> call SCI_GETCOLUMN, and in a search through Textadept's .lua modules, I
>>> couldn't find any references to SCI_ functions to use as an
>>> example.  I tried
>>> this:
>>>
>>>   local pos = buffer.current_pos
>>>   local sci_pos = SCI_GETCOLUMN(pos)
>>>
>>> but it generates errors about a nil value?
>>
>> Based on the guidance I gave you, the Scintilla message
>> SCI_GETCOLUMN(pos) would be transformed into Lua as
>> `buffer.column[pos]`. This is what you said you discovered in a
>> previous e-mail. You'll have to play around with `buffer.column[]` to
>> see if you can get what you want with virtual space. Maybe take a
>> look at SciTE's source code to see what it is doing in order to show
>> the correct column number when virtual space is enabled.
>>
>> Cheers,
>> Mitchell
>
> Sorry I am so slow in understanding, but your example has helped
> greatly.  So the 'SCI_' is changed to 'buffer', with either ':' or
> '.', then followed by the property (in this case), but with the 'GET'
> or 'SET' removed?
>
> The ones I am hoping to use are:
>
> SCI_GETMAINSELECTION --> buffer.main_selection
> SCI_GETCOLUMN --> buffer.column
> SCI_GETSELECTIONNCARET --> buffer.selection_n_caret
> SCI_GETSELECTIONNCARETVIRTUALSPACE --> buffer.selection_n_caret_virtual_spcace
>
> Are those the correct transformations, and are they all available? Thanks!
>
> qwerky

-- 
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 Thu 11 Jul 2019 - 12:32:06 EDT

This archive was generated by hypermail 2.2.0 : Fri 12 Jul 2019 - 06:48:50 EDT