Re: [code] Adding multiple selection on double click

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

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:30:16 EDT

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