Re: find dialog fills in word under cursor

From: Scott Weisman <sweis....at.gmail.com>
Date: Mon, 12 Dec 2011 03:49:35 -0800 (PST)

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.
Received on Mon 12 Dec 2011 - 06:49:35 EST

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