Re: [code] Adding multiple selection on double click

From: Milind Gupta <milind.gupta.att.gmail.com>
Date: Fri, 14 Jul 2017 10:41:15 -0700

Another interesting observation is that if I put the line:

*ui.dialogs.colorselect({title="Hello"})*

just before the line buffer.first_visible_line=fl then it pops up the
dialog but first_visible_line works now.

Somehow without any ui interaction the buffer.first_visible_line=fl has no
effect. I don't know if this is a bug.

Milind

On Fri, Jul 14, 2017 at 10:30 AM, Milind Gupta <milind.gupta.att.gmail.com>
wrote:

> Hi Mitchell,
> I am using Version 9.3 and the function in findall.lua seems to
> work fine. I have pasted it below:
>
> function findAllAtCursor()
> local retVal = {}
> local position = buffer.current_pos
> -- Grab the word that was clicked on
> buffer:word_left()
> buffer:word_right_end_extend()
> needle = buffer:get_sel_text()
> -- Trim any whitespace
> needle = needle:gsub('%s', '')
> -- Escape unwanted characters
> needle = needle:gsub('([().*+?^$%%[%]-])', '%%%1')
> -- Don't look for zero-length strings
> if #needle > 0 then
> for i = 0, buffer.line_count do
> local text = buffer:get_line(i)
> if #text>0 then
> local first, last = 0, 0
> while first do
> first, last = text:find("%f[%w]"..needle.."%f[%W]",last)
> if last then
> if (first ~= nil) and (first >0) then
> first = first - 1
> end
> table.insert(retVal, {buffer:position_from_line(i) + first,
> buffer:position_from_line(i) + last})
> last = last + 1
> end
> end
> end
> end
> end
> buffer:set_sel(position, position)
> return retVal
> end
>
> Do you have more suggestions I can try to solve the scrolling problem?
>
> Thanks,
> Milind
>
> On Fri, Jul 14, 2017 at 6:12 AM, Mitchell <m.att.foicica.com> wrote:
>
>> Hi Milind,
>>
>> On Thu, 13 Jul 2017, Milind Gupta wrote:
>>
>> Hi Mitchell,
>>> Thank you for the reply. I tried your suggestion but the it still
>>> behaves the same. Did it work in your setup?
>>>
>>
>> No, I did not try it since the "findall.lua" you linked to is for an
>> older version of Textadept and not compatible with newer versions.
>>
>>
>> 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.
>>
>>
>

-- 
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 Fri 14 Jul 2017 - 13:41:15 EDT

This archive was generated by hypermail 2.2.0 : Sat 15 Jul 2017 - 06:38:09 EDT