Re: [code] [textadept]control+tab with MRU

From: Gabrielm Dubatti <gdubatti.att.gmail.com>
Date: Sat, 19 Mar 2016 18:09:12 -0300

Hi Hugh,

     I don't think your code will work because every time you press
ctrl+tab you will receive the same event: code=9 (TAB) and control=true.

     I detected the "first time" the control key is pressed "alone" to
distinguish the first ctrl+tab form the rest in the group (until you
actually release the control key).

     I'll look into the namespace pollution asap.

     Best regards,
     Gabriel

El 19/03/16 a las 17:57, Hugh Low escribió:
>
> Hey, I had a quick read of your code.
>
> Instead of using the check ‘if code == 0xFFE3 then --control key
> pressed?’ on KEYPRESS events, might the following code be more efficient?
>
> events.connect(events.KEYPRESS, function(code, shift, control, alt, meta)
>
> if (not control) or (code ~= 9) then -- (9 == string.byte(‘\t’))
>
> return;
>
> elseif shift then -- control-shift-tab
>
> else -- control-tab
>
> end
>
> ctrl_key_down = true;
>
> end);
>
> Apologies in advance if I’ve missed something obvious which renders
> the above code useless. One other thing, are all the globally defined
> variables intended to be global? They will pollute textadept’s _ENV.
>
> I’m quite excited about this idea. Would you mind sending another
> e-mail when you commit your final draft to the wiki?
>
> Thanks in advance 😊
>
> Hugh
>
> *From: *Gabrielm Dubatti <mailto:gdubatti.att.gmail.com>
> *Sent: *19 March 2016 20:00
> *To: *code.att.foicica.com <mailto:code.att.foicica.com>
> *Subject: *[code] [textadept]control+tab with MRU
>
> Hi,
>
> Here is the code I wrote to implement control+tab and control+shift+tab
> buffer cycling using a MRU list (like a lot of other editors/IDE do).
> Holding the control key down while pressing tab / shift tab, allows you
> to select the buffer to jump into.
>
> I will sincerely appreciate if someone test it and/or send me some
> feedback before I published it in the wiki.
>
> To try it, just add the code to your init.lua file.
>
> Best wishes,
> Gabriel
> ......
> ......
> --
> 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.
>

-- 
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 Sat 19 Mar 2016 - 17:09:12 EDT

This archive was generated by hypermail 2.2.0 : Sun 20 Mar 2016 - 06:36:43 EDT