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.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Bug reports ➜ Clicking a hyperlink erroneously adds an empty string to the command history

Clicking a hyperlink erroneously adds an empty string to the command history

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


Posted by Kahenraz   (75 posts)  Bio
Date Tue 03 Apr 2018 03:28 PM (UTC)

Amended on Tue 03 Apr 2018 03:34 PM (UTC) by Kahenraz

Message
<alias
   name="TEST"
   match="test"
   enabled="y"
   omit_from_command_history="y"
   send_to="12"
   sequence="100"
  >
  <send>
    Hyperlink("test2", "info", "", "", "", 0)
    Note("")
  </send>
</alias>


This alias is just an example which places a hyperlink. The bug is that when clicking on a hyperlink, a blank entry is added to the command history.

For example:

> look
(player looks)
> test
(displays hyperlink)
> click hyperlink
(does link thing)

Now if you hit the up arrow it will show a blank entry instead of the last command in the history.

I'm trying to pair clicking on a link which sends one command to the world but the command sent to the history buffer is different: https://www.gammon.com.au/forum/?id=14229

The fact that there is a lank entry immediately after clicking on a link means that I always have to hit the up arrow twice instead of just once after clicking on a hyperlink.
Top

Posted by Fiendish   USA  (2,534 posts)  Bio   Global Moderator
Date Reply #1 on Wed 04 Apr 2018 03:25 AM (UTC)

Amended on Wed 04 Apr 2018 03:26 AM (UTC) by Fiendish

Message
I can confirm that clicking the given hyperlink adds an empty entry in the command history, though cycling past it and back seems to make it disappear (???).

A workaround would be to use the plugin function call format as discussed in https://mushclient.com/forum/bbshowpost.php?bbsubject_id=14211

Or possibly you could just immediately edit the command history via an alias to remove that extra empty entry.

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #2 on Wed 04 Apr 2018 05:19 AM (UTC)
Message
I can't reproduce that. No additional entry is being added to the command history. It might be related to what test2 does, which you haven't shown.

When you copy and paste aliases into forum messages can you please leave in the lines <aliases> ... </aliases> ?

I don't know how you are getting rid of them, or why, but it makes copying and pasting for testing harder.

Template:copying For advice on how to copy aliases, timers or triggers from within MUSHclient, and paste them into a forum message, please see Copying XML.


Template:version Please help us by advising the version of MUSHclient you are using. Use the Help menu -> About MUSHclient.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #3 on Wed 04 Apr 2018 05:52 AM (UTC)

Amended on Wed 04 Apr 2018 05:53 AM (UTC) by Nick Gammon

Message

The code for adding to the command history specifically disallows adding empty strings:


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Fiendish   USA  (2,534 posts)  Bio   Global Moderator
Date Reply #4 on Wed 04 Apr 2018 02:06 PM (UTC)

Amended on Wed 04 Apr 2018 02:09 PM (UTC) by Fiendish

Message
Nick, simple test case:

Run Hyperlink("test2", "info", "", "", "", 0) from your input bar using your defined script prefix.

Then, if Auto-repeat Command is enabled, press backspace to clear the input bar.

Then press up arrow. (to see that the hyperlink invocation is one line back)
Then press down arrow.

Then click on the hyperlink.
If you're connected to a server at the time, you may get a command not recognized message back.

Then press up arrow.
Then press up arrow again.

Note that before clicking the hyperlink, the command invocation is one line back, and that it is two lines back after clicking the hyperlink.

Then press down arrow as many times as you want.
Then press up arrow to see that the invocation is again one line back.

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #5 on Wed 04 Apr 2018 09:11 PM (UTC)

Amended on Wed 04 Apr 2018 09:12 PM (UTC) by Nick Gammon

Message

Both of you were incorrect that an empty string was added to the command window, which is why I couldn’t reproduce it. After running your tests (clicking the hyperlink) I immediately pressed Ctrl+H to see the command history, and there was no extra, blank, command there, which then mysteriously disappeared later. :)

What was actually happening was that when you click on the output window, the focus moves to that part of the screen. You will notice that when you click on the output window the cursor stops flashing in the command window, because it no longer has the focus.

Certain actions, like ordinary typing, are designed to first put the focus back into the command window, which is why you probably don’t usually notice this.

See here for example:

However the command window expects a special message (ID_KEYS_PREVCOMMAND, not WM_CHAR) in order to call the function which recalls the previous command, so that wasn’t acted on.

If you look carefully at your current version, when you press up-arrow after clicking on the hyperlink, the cursor starts flashing in the command window, so now pressing up-arrow recalls the previous command.

I’ve made a modification to force the focus back to the command window after clicking on a hyperlink (commit b9e52a1) which is available now from the pre-release page, see here.


This has been an interesting example of the X-Y Problem - both of you confidently reported that an extra entry was being inserted into the command window, something I couldn’t reproduce because I immediately pressed Ctrl+H to view the command window.

What the problem really was: After clicking on a hyperlink, pressing up-arrow to recall the previous command does not work. Or if you were really observant: After clicking on a hyperlink the focus does not return to the command window.


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Fiendish   USA  (2,534 posts)  Bio   Global Moderator
Date Reply #6 on Wed 04 Apr 2018 09:36 PM (UTC)
Message
Ooh, good eyes.

https://github.com/fiendish/aardwolfclientpackage
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.


19,566 views.

It is now over 60 days since the last post. This thread is closed.     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.