[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Suggestions
. . -> [Subject]  Improving accelerator support
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Improving accelerator support

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by Ked   Russia  (524 posts)  [Biography] bio
Date Sat 10 Jun 2006 06:59 AM (UTC)
Message
Currently, if you override a key or a key combination, the only way to remove the override is by replacing it with an empty string. That doesn't really remove the accelerator binding from a key, but just replaces it with nothing.

It would be better to completely remove the binding, as if it never existed, which is the case when the client is restarted - you just loose any accelerators that were defined in the previous session.

Doing it this way would allow users more flexibility, since then we'd be able to temporarily override not just modifier+key combinations, but actually any key on the keyboard, e.g. Accelerator("e", "eat food").
[Go to top] top

Posted by Indoum   Sweden  (17 posts)  [Biography] bio
Date Reply #1 on Sat 10 Jun 2006 05:21 PM (UTC)
Message
Also, it'd be nice if accelerators in plugins could act like those in the main space. For example..

somevar = "gammon"
Accelerator("F1", "/Send('look at ' .. somevar)")
somevar = "indoum"


In the main space the F1 accelerator would send "look at indoum" while in a plugin it would send "look at gammon".
[Go to top] top

Posted by Nick Gammon   Australia  (21,384 posts)  [Biography] bio   Forum Administrator
Date Reply #2 on Mon 12 Jun 2006 12:16 AM (UTC)
Message
Quote:

It would be better to completely remove the binding, as if it never existed ...


I'm not sure why you would need to do this a lot. I don't think it is easy to find what the default binding is for an accelerator. In your example you can always restore "e" like this:


Accelerator("e", "e")


Quote:

Also, it'd be nice if accelerators in plugins could act like those in the main space.


I'm not sure how this would be implemented. You are normally in the "main space" except for the brief moments when a trigger fires, or an alias matches. I don't know how you would be in an plugin for long enough for keystrokes to be registered "in the plugin space".

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Ked   Russia  (524 posts)  [Biography] bio
Date Reply #3 on Mon 12 Jun 2006 05:39 AM (UTC)
Message
Quote:
Accelerator("e", "e")


That won't work, since "e" would then go through alias matching and on to the world, instead of to the command window. The only way to make it work that I've managed to figure out is to make these sorts of accelerators call a function that would do something like:

function replaceCom(char)
local com = GetCommand()
SelectCommand()
PasteCommand(com .. char)
end


But my main point is that documentation for the accelerators states that they are "removed" by setting them to an empty string, when in fact there is right now no way to remove them at all, save for reloading Mushclient... Actually, reloading the world works too.
[Go to top] top

Posted by Nick Gammon   Australia  (21,384 posts)  [Biography] bio   Forum Administrator
Date Reply #4 on Mon 12 Jun 2006 07:40 AM (UTC)
Message
Quote:

But my main point is that documentation for the accelerators states that they are "removed" by setting them to an empty string ...


I take your point, however I can't see where the documentation says that. Can you give me a link?

I have amended the Accelerator behaviour to do what you suggest, as I can see that making a key like "a" into an accelerator and then back to simply being "a" would be difficult or impossible with the current system.

However I can now see a problem that if you simply want to disable "a" then you can't now - unless you made the send string something like "/" (an empty script command).

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Ked   Russia  (524 posts)  [Biography] bio
Date Reply #5 on Mon 12 Jun 2006 09:21 AM (UTC)
Message
Hmm, actually I am not sure myself were I got the "removed" part :) Probably from this:

Quote:
Accelerator ("Alt+F4", "") -- disable Alt+F4


Though now I see that you meant "disable the key combination", not "disable an accelerator bound to the key combination".

Maybe, in order to make it completely logical, instead of removing accelerators when an empty string is passed - remove them on a False value, and just leave strings as they were? That way no confusion can arise from the fact that some strings set accelerators and others remove them? Want to remove an accelerator - pass in False, or nil/false for Lua?
[Go to top] top

Posted by Nick Gammon   Australia  (21,384 posts)  [Biography] bio   Forum Administrator
Date Reply #6 on Mon 12 Jun 2006 09:34 AM (UTC)
Message
Aha, yes, the "disable" refers to sending an empty string, not resetting to initial behaviour, however I still understand your point.

My thinking in implementing it that way was that you probably would not even use the Accelerator function if you wanted the original behaviour.

The prototype for it is:

long Accelerator(BSTR Key, BSTR Send);

Thus, sending in "false" is not an option, except in the Lua interface.

My only problem with releasing the improved version is that, if anyone actually did what the example suggested, namely:

Accelerator ("Alt+F4", "") -- disable Alt+F4

... then that would no longer work. However perhaps no-one really does that?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Ked   Russia  (524 posts)  [Biography] bio
Date Reply #7 on Mon 12 Jun 2006 10:36 AM (UTC)
Message
Well, the idea of disabling a key by setting it to "" never even crossed my mind, despite having read just that plainly written in the help file. :) So I'd say that the need to remove an accelerator is more common than the one to disable it, so if people were using accelerators in ways that would require either action, then this point would've probably come up before. Just a subjective guess though.
[Go to top] top

Posted by Nick Gammon   Australia  (21,384 posts)  [Biography] bio   Forum Administrator
Date Reply #8 on Mon 12 Jun 2006 09:45 PM (UTC)
Message
I will leave the new behaviour in version 3.75 - it is now documented in the release notes.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


4,341 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]