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

From: Niklas W <nikw.att.gmx.com>
Date: Wed, 4 Nov 2015 21:24:26 +0100

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

-- 
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 Wed 04 Nov 2015 - 15:24:26 EST

This archive was generated by hypermail 2.2.0 : Thu 05 Nov 2015 - 06:48:18 EST