Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ Suggestions
➜ Improving accelerator support
Improving accelerator support
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Ked
Russia (524 posts) 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").
| Top |
|
Posted by
| Indoum
Sweden (17 posts) 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". | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) 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 | Top |
|
Posted by
| Ked
Russia (524 posts) 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. | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) 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 | Top |
|
Posted by
| Ked
Russia (524 posts) 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?
| Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) 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 | Top |
|
Posted by
| Ked
Russia (524 posts) 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. | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) 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 | 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.
22,807 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top