Re: [textadept] Key commands in menu

From: mitchell <c....at.caladbolg.net>
Date: Tue, 26 Jul 2011 12:53:10 -0400 (Eastern Daylight Time)

Robert,

On Tue, 26 Jul 2011, Robert wrote:

> Hi Mitchell,
>
> I implemented a very basic proof-of-concept of the idea described below.
> It is against version 3.6 as this is the last one with the
> string-based approach for key commands.
> My main problem back then was getting key chains right, but with the
> new key commands this might actually be a way to avoid having two
> systems to define key short cuts.

Here's my rationale: keychains should be for power-users who would likely
have their chains memorized and don't need them in menus. Everyone else
should have simple shortcuts and that is what is reflected in the new menu
code. I think having two ways to define key commands is inevitable to
cater to both sides.

> There are of course lots of issues with this simple patch (KEYSYMS
> shows up, special keys like Tab are not escaped, ...) but just to show
> it could work.

Thanks for the patch, but I think I recall trying something like this a
while ago and ran into the same problems that you describe, as well as
'gtk-new Ctrl+N' menuitems I mentioned earlier. While initially promising,
I think this route is a dead end.

mitchell

>
> Robert
>
> On Wed, Mar 30, 2011 at 3:07 AM, mitchell <c....at.caladbolg.net> wrote:
>> Hi Robert,
>>
>> On Tue, 29 Mar 2011, Robert wrote:
>>
>>> Hi,
>>>
>>> there was some Textadept discussion on the Lua mailing list[1] with
>>> questions about key commands displayed in the menu.
>>>
>>> Mitchell,
>>> have you considered creating a string representation of the keys table
>>> entries and using these in the menu creation?
>>
>> I think at this point I've considered everything under the sun that I can
>> think of and every time there is either a dead-end, ugly hack, corner-case,
>> etc. that I come upon after investing a decent amount of time; at this point
>> hard-coding is looking desirable. At any rate I am not going to work on this
>> seeing as I don't use the menu. I will accept patches of course.
>>
>> mitchell
>>
>>> For the table entries I iterate over them and concatenate their string
>>> representations for a key.
>>> I tested this and it works for simple functions and table entries like
>>> { _buffer.save, _buffer } but not for those buffer functions that are
>>> not set within Textadept because the function, e.g. _buffer.undo, is
>>> not the same in the menubar and keys tables.
>>> I think with the old string based approach this might be possible but
>>> I'm not sure about the new metatable based approach.
>>> It's of course not fully dynamic, but you could do
>>>
>>> keys.cn = nil
>>> keys.an = new_buffer
>>> _m.textadept.menu.set_menubar(_m.textadept.menu.menubar)
>>>
>>> and the menu is updated.
>>>
>>> Robert
>>>
>>> [1] http://lua-users.org/lists/lua-l/2011-03/threads.html#00867
>>>
>>> --
>>> 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.
>>>
>>>
>>
>> mitchell
>>
>> --
>> 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.
>
> --
> 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.
>
>

mitchell
Received on Tue 26 Jul 2011 - 12:53:10 EDT

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