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
➜ Bug reports
➜ getSelectionEndLine always returns zero
|
getSelectionEndLine always returns zero
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Blackbear
USA (4 posts) Bio
|
| Date
| Fri 28 Mar 2003 01:06 AM (UTC) |
| Message
| The following jscript:
function sendHi () {
line = world.GetLineInfo(world.getSelectionEndLine(), 1);
world.send("Line is:" + line + ", end-line is " + world.getSelectionEndLine());
}
when bound to the keypad, returns the following regardless of whether text has been selected in the output window:
You say: Line is:undefined, end-line is 0
| | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Fri 28 Mar 2003 09:30 PM (UTC) |
| Message
| I see what you mean here, but the problem is that the selection tends to get cancelled when you type something, so that by the time the script executes the selection has gone.
You can make it work by selecting some text, opening an immediate window (Ctrl+I) and then typing:
world.note (world.GetSelectionEndLine ());
and hit "run". Then you will see a non-zero response. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Blackbear
USA (4 posts) Bio
|
| Date
| Reply #2 on Sat 29 Mar 2003 05:45 PM (UTC) |
| Message
| Ok, but I'm binding the function to a keypad event. That shouldn't clear the selection if a function is bound to it. What I want to be able to do is highlight a name, hit a key, and have it generate a "hello"
James | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #3 on Sun 30 Mar 2003 07:32 AM (UTC) |
| Message
| I am investigating this. There seems to be a bug in MUSHclient's handling of selected text, however my interim result is it works better if you double-click the word rather than click-and-drag.
Once I get my example to work - whenever that is ;) - I will post the result. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Blackbear
USA (4 posts) Bio
|
| Date
| Reply #4 on Tue 01 Apr 2003 04:26 AM (UTC) |
| Message
| You're absolutely right, double-clicking works fine. Go figure.
James | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #5 on Thu 03 Apr 2003 12:18 AM (UTC) |
| Message
| This problem is fixed in 3.35 - it actually was two problems. Double-clicking a word should also have not worked *evilgrin* - because it should have paused the output window, like clicking and dragging.
That has been fixed. However your script will now work, because I have rearranged the order in which things are done, so the selection will be valid when the script executes. |
- 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.
18,669 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top