Register forum user name Search FAQ

Gammon Forum

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.
 Entire forum ➜ MUSHclient ➜ Lua ➜ AcceleratorList updating after clearing an accelerator

AcceleratorList updating after clearing an accelerator

You need to log onto the forum to reply or create new threads.

  Refresh page


Posted by Norn   (1 post)  Bio
Date Sat 12 Oct 2024 10:21 PM (UTC)
Message
Hi all,

--

TL;DR: Can we please update AcceleratorList when clearing accelerators? Is there any way we can fully clear an accelerator and fully restore default behavior? Thank you.

--

I saw this issue previously on the forums, but it seems to still be cropping up.

It seems like accelerators remain on AcceleratorList() after being cleared.

First, we set an Accelerator with either Accelerator("Ctrl+Q", "say hi") or AcceleratorTo("Ctrl+Q", "say hi", 0), for example.

AcceleratorList() will show:

Key: "Ctrl-Q"
Value: "say hi"

Pressing Ctrl-Q sends the command as expected.

Next, we clear the accelerator using Accelerator("Ctrl+Q", ""), for example.

Now, we press Ctrl-Q, the command is no longer sent - OK.
However, we still see the old key/value pair in AcceleratorList().

Also, it seems like setting the accelerator to "" actually just sets the accelerator to execute an empty command, although I may be mistaken. For example, if you overwrite Ctrl-C and then clear the Accelerator, default (copy) behavior is not restored and it appears to continue to send a blank command.

Any chance we can have a function that will allow us to fully restore behavior?

Thanks for the time.
Top

Posted by Nick Gammon   Australia  (23,100 posts)  Bio   Forum Administrator
Date Reply #1 on Thu 17 Oct 2024 03:43 AM (UTC)
Message
Getting the accelerators to work was quite fiddly, because Windows doesn't let you just change one accelerator, you have to copy the lot and modify the copy.

I didn't worry too much about putting things back because, after all, if you change an accelerator then hopefully this is a one-time thing, eg. you want Ctrl+J to do something else than normal and you always want it to do that.

Since I couldn't easily put the old accelerator behaviour back, then clearing the accelerator just involved putting an empty string there.

All of the existing menu actions can be executed by using "DoCommand" so if you wanted to put the original behaviour of Ctrl+Q back you could do this:


AcceleratorTo ('Ctrl+Q' , 'DoCommand ("ExitClient") ' , sendto.script )

- 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.


301 views.

You need to log onto the forum to reply or create new threads.

  Refresh page

Go to topic:           Search the forum


[Go to top] top

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