Re: [textadept] Re: find dialog fills in word under cursor

From: mitchell <c....at.caladbolg.net>
Date: Mon, 12 Dec 2011 19:19:44 -0500 (EST)

Hi,

On Tue, 13 Dec 2011, Tymur Gubayev wrote:

> Allow me one small correction:
> code like `#text == 0` is very slow in Lua, it's always better to
> compare string with an empty string, i.e. ` text == '' `

That is true, but since nobody can hit Control+F 10,000 times per second,
the difference in speed is negligible :)

mitchell

>
> Wbr,
> Tymur
>
> On 12 December 2011 12:49, Scott Weisman <sweis....at.gmail.com> wrote:
>> I found it. There are two parts. First, if no text is selected, then
>> use the word under the cursor. Second, if text is selected, use that.
>>
>> keys.cf = { function ()
>> � �local buffer = buffer
>> � �local text = buffer:get_sel_text()
>> � �if #text == 0 then
>> � � � �text =
>> buffer:text_range(buffer:word_start_position(buffer.current_pos),
>>
>> buffer:word_end_position(buffer.current_pos))
>> � � � �text = text:gsub("^%s*(.-)%s*$", "%1")
>> � �end
>> � �gui.find.find_entry_text = text
>> � �gui.find.focus()
>> end }
>>
>> On Dec 8, 7:02�pm, Patrick McMorris <patr....at.sixpack.ca> wrote:
>>> When you figure it out I'd like to know too.
>>>
>>> I'd like it to grab only the characters currently selected (and leave the
>>> previous find if nothing is currently selected). �This behavior is more
>>> like other editors that I'm accustomed to.
>>>
>>> Patrick
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> On Thu, Dec 8, 2011 at 7:56 AM, Scott Weisman <sweis....at.gmail.com> wrote:
>>>> I'm pretty sure I asked this question before, but I can't find it
>>>> (:-).
>>>
>>>> I thought I had this working a while back. Maybe I overwrote it a
>>>> while back.
>>>
>>>> When I do Control-F, the find dialog fills in the last-used find
>>>> string. I want it to fill in the word under the cursor. How can I do
>>>> that?
>>>
>>>> --
>>>> You received this message because you are subscribed to the Google Groups
>>>> "textadept" group.
>>>> To post to this group, send email to textadept.at.googlegroups.com.
>>>> To unsubscribe from this group, send email to
>>>> textadept+unsubscribe.at.googlegroups.com.
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/textadept?hl=en.
>>
>> --
>> You received this message because you are subscribed to the Google Groups "textadept" group.
>> To post to this group, send email to textadept.at.googlegroups.com.
>> To unsubscribe from this group, send email to textadept+unsubscribe.at.googlegroups.com.
>> For more options, visit this group at http://groups.google.com/group/textadept?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups "textadept" group.
> To post to this group, send email to textadept.at.googlegroups.com.
> To unsubscribe from this group, send email to textadept+unsubscribe.at.googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/textadept?hl=en.
>
>

mitchell
Received on Mon 12 Dec 2011 - 19:19:44 EST

This archive was generated by hypermail 2.2.0 : Thu 08 Mar 2012 - 12:25:40 EST