Re: Find Dialog Suggestion

From: Jay <robert.jay.go....at.gmail.com>
Date: Thu, 6 May 2010 19:22:03 -0700 (PDT)

Ryan, even better :)
Oh, and I just realized that I had totally forgotten about '%c'
pattern!

-Jay

On May 7, 3:22 am, Ryan Pusztai <rpusz....at.gmail.com> wrote:
> On Thu, May 6, 2010 at 2:11 PM, Ryan Pusztai <rpusz....at.gmail.com> wrote:
>
> > Nice. I even improved it a bit more by adding the current word if there is
> > no selected text.
> > --  key_commands.lua ---------------
> > local m_editing = _m.textadept.editing
> > -- Add the current selection/word under the cursor to the default find.
> > keys.cf = {
> > function()
> > local buffer = buffer
> >  local t = textadept
> > local text = buffer:get_sel_text()
> > if #text == 0 then
> >  -- select current word
> > m_editing.current_word()
> > -- get the selected text
> >  text = buffer:get_sel_text()
> > buffer:clear_selections()
> > end
>
> > t.find.find_entry_text = text
>
> > t.find.focus()
> > end }
> > ---------------
>
> > The only thing that is sorta wierd is that the current_word() function is
> > getting the end of line charascters if your cursor is on the end of the
> > line.
> > Example: if the cursor is next to the 'd' in 'end' it will pick up
> > "end<LF>" instead of "end"
> > Any ideas?
>
> > Man TextAdept is so configurable!
>
> Sorry for replying to myself, but I fixed the weird behavior by removing the
> EOL characters.
>
> So here is an update:
>
> --  key_commands.lua ---------------
> local m_editing = _m.textadept.editing
> -- Add the current selection/word under the cursor to the default find.
> keys.cf = {
> function()
> local buffer = buffer
>  local t = textadept
> local text = buffer:get_sel_text()
> if #text == 0 then
>  -- select current word
> m_editing.current_word()
> -- get the selected text
>  text = buffer:get_sel_text():gsub( "%c", "" )
> buffer:clear_selections()
>  end
>
> t.find.find_entry_text = text
>
> t.find.focus()
> end }
> ---------------------
>
> I don't know if this could go in the main application, but I find this very
> helpful.
> --
> Regards,
> Ryan
>
> --
> 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 athttp://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.
Received on Thu 06 May 2010 - 22:22:03 EDT

This archive was generated by hypermail 2.2.0 : Thu 08 Mar 2012 - 11:45:13 EST