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
➜ Tips and tricks
➜ Redefine Ctrl+Backspace accelerator
Redefine Ctrl+Backspace accelerator
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Ulenspiegel
(5 posts) Bio
|
Date
| Sun 25 Jun 2017 07:11 AM (UTC) |
Message
| Hello!
This brings up a question that was coming up before at least twice in different categories of forum, but I don't think it received any resolution. Reply http://www.gammon.com.au/forum/?id=10818&reply=7#reply7 suggests that, to redefine behavior of Ctrl+Backspace, one can use AcceleratorTo(). Does anybody know how, in the script argument of AcceleratorTo(), delete the last word before cursor? Is there Lua functions for editing the text in input area (I'm looking for 'delete last word' or, for the lack of it, something like 'select previous word' + 'delete selection' functions)? | Top |
|
Posted by
| Fiendish
USA (2,533 posts) Bio
Global Moderator |
Date
| Reply #1 on Sun 25 Jun 2017 08:22 AM (UTC) Amended on Sun 25 Jun 2017 08:23 AM (UTC) by Fiendish
|
Message
| Try
GetCommand, find the last word, SelectCommand (or SetCommandSelection if you prefer), and then PasteCommand |
https://github.com/fiendish/aardwolfclientpackage | Top |
|
Posted by
| WillFa
USA (525 posts) Bio
|
Date
| Reply #2 on Sun 25 Jun 2017 03:30 PM (UTC) Amended on Sun 25 Jun 2017 03:33 PM (UTC) by WillFa
|
Message
| nm, SetCommand tries to save us from ourselves. | Top |
|
Posted by
| Fiendish
USA (2,533 posts) Bio
Global Moderator |
Date
| Reply #3 on Sun 25 Jun 2017 06:45 PM (UTC) |
Message
|
WillFa said:
nm, SetCommand tries to save us from ourselves.
lol, yup. PasteCommand claims not to, though. |
https://github.com/fiendish/aardwolfclientpackage | Top |
|
Posted by
| Ulenspiegel
(5 posts) Bio
|
Date
| Reply #4 on Tue 27 Jun 2017 01:20 AM (UTC) Amended on Tue 27 Jun 2017 01:22 AM (UTC) by Ulenspiegel
|
Message
| Everything works well now; thank you all for the help. :)
I think I'll leave that fragment of code here in this thread, in case somebody else will come looking.
function DeleteWordBeforeCursor()
local sel_end = GetInfo(237)
if sel_end == 0 then
local word_end = GetInfo(236) - 1
if word_end ~= 0 then
local cmd = GetCommand()
local word_begin = string.find(string.sub(cmd, 1, word_end), "%S*%s*$")
if word_begin ~= nil then
SetCommandSelection(word_begin, word_end)
PasteCommand("")
end
end
else
PasteCommand("")
end
end
-- Redefine Ctrl+Backspace to delete word before caret position.
AcceleratorTo("Ctrl+Backspace", "DeleteWordBeforeCursor()", sendto.script)
| 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.
20,307 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top