Re: [code] [textadept] automatically fill the Find field with selected text for Ctrl-F

From: Ziegenlippe <ziegenlippe.att.googlemail.com>
Date: Tue, 10 Nov 2015 16:46:00 +0100

On 04.11.2015 21:24, Niklas W wrote:
> On Wed, 4 Nov 2015 09:16:04 -0500 (EST)
> Mitchell <m.att.foicica.com> wrote:
>
>> You could rebind the keybinding for find with something like this in your
>> ~/.textadept/init.lua:
>>
>> keys.cf = function()
>> local s = buffer:word_start_position(buffer.current_pos, true)
>> local e = buffer:word_end_position(buffer.current_pos, true)
>> ui.find.find_entry_text = buffer:text_range(s, e)
>> ui.find.focus()
>> end
>>
>> That will auto-populate the find entry.
> I changed it slightly and will keep this one myself. Thanks. :)
>
> keys.cf = function()
> local s = buffer.selection_start
> local e = buffer.selection_end
> if s ~= e then
> ui.find.find_entry_text = buffer:text_range(s, e)
> end
> ui.find.focus()
> end
This is exactly what I was looking for.
Thanks a lot to all of you.
--David

-- 
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 Tue 10 Nov 2015 - 10:46:00 EST

This archive was generated by hypermail 2.2.0 : Wed 11 Nov 2015 - 06:50:14 EST