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 ➜ General ➜ Hyperlinks with | character in action or tooltip seems to be broken?

Hyperlinks with | character in action or tooltip seems to be broken?

Posting of new messages is disabled at present.

Refresh page


Posted by Athlau   (2 posts)  Bio
Date Thu 09 Feb 2023 05:13 AM (UTC)

Amended on Thu 09 Feb 2023 09:50 AM (UTC) by Athlau

Message
It seems that for some reason Hyperlink's action and tooltip are cut at the first | character.

I'm running the following code from command input box, doing that in a separate script file have exactly the same behaviour:

\\\k="echo A|B|C";Hyperlink(k, k, k, "cyan", "blue", false, false);Note()

\\\ is lua script prefix for command line in client settings.

As expected it shows "A|B|C" with cyan on blue, however
mouse tooltip shows only "echo A" and if I click the hyperlink it will only send "echo A" command.

I've tried to escape '|' as
k="echo A\\|B"
k="echo A||B"
k="echo A%|B"
It displays hyperlink as expected but the tooltip and action are still cut at first |

Any ideas how to workaround that?
Top

Posted by AdInfinitum   (74 posts)  Bio
Date Reply #1 on Thu 09 Feb 2023 03:53 PM (UTC)

Amended on Thu 09 Feb 2023 03:59 PM (UTC) by AdInfinitum

Message
I don't see where Hyperlinks ever accepted multiple options in one hyperlink.

However, one workaround you can do to produce the result you're wanting is something like:


k = "echo "
kc = {"A", "B", "C"}

for i,v in ipairs(kc) do
   if i < #kc then v = v .. "|" end
   Hyperlink(k .. v, (v and i == 1 and k or "") .. v, v, "cyan", "blue", false, false)
end
Note("")


That will produce the output of:

echo A|B|C

and function correctly when selecting the letter.

There probably is a cleaner way to do that, but that's my solution that works.
Top

Posted by Nick Gammon   Australia  (23,122 posts)  Bio   Forum Administrator
Date Reply #2 on Thu 09 Feb 2023 06:55 PM (UTC)
Message
Are you using "|" as a command separator? I'm confused as to why you expect the "|" character to have a special action here.

- Nick Gammon

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

Posted by AdInfinitum   (74 posts)  Bio
Date Reply #3 on Thu 09 Feb 2023 08:30 PM (UTC)
Message
Nick Gammon said:

Are you using "|" as a command separator? I'm confused as to why you expect the "|" character to have a special action here.


I think that's precisely what Athlau intended to do, and I have no idea where the thought it was even possible originated.
Top

Posted by Athlau   (2 posts)  Bio
Date Reply #4 on Thu 09 Feb 2023 09:04 PM (UTC)

Amended on Thu 09 Feb 2023 09:12 PM (UTC) by Athlau

Message
It looks like I wasn't clear in my message, sorry.

I have no intention to use | as multi choice separator or anything like that. All I'm trying to do is literally issue a command "echo A|B", regardless of where you click on a Hyperlink. But for some reason the Hyperlink code just strips out all the characters starting from "|". And yes, there's nothing in the docs suggesting that "|" should have any special meaning for Hyperlinks... but somehow it does have it?

I've tried to simplify the test case, so it started to look like it's A or B thingy, but it's not.

In fact I'm just dumping hyperlinks for mapper's custom exits which contain some minimap matching strings and "|" often appears there as a vertical wall.
So for Hyperlinks like:
"minimap_to [ <$>|]", it will correctly output a line
minimap_to [ <$>|]"
But both tooltip and actual command executed when clicking it
will be stripping all starting from first encountered "|".
So it becomes just "minimap_to [ <$>"

Here's a screenshot just in case...
https://user-images.githubusercontent.com/118027636/217938628-4e822b6a-b964-4119-b4d4-2bf991c2b21e.png

Hope it clarifies my question.
Top

Posted by Nick Gammon   Australia  (23,122 posts)  Bio   Forum Administrator
Date Reply #5 on Thu 09 Feb 2023 10:03 PM (UTC)

Amended on Thu 09 Feb 2023 10:12 PM (UTC) by Nick Gammon

Message
I haven't worked on this code for a while, but it seems that in:

https://github.com/nickgammon/mushclient/blob/master/mushview.cpp#L2250 (around line 2250)

The code appears to be separating what you entered at the "|" symbols, as it would for a menu item:

http://www.gammon.com.au/scripts/doc.php?function=Menu

On the face of it, this looks like a bug.

As a work-around I suggest replacing "|" with something similar (like a forward slash) or maybe some Unicode symbol if you are displaying Unicode (UTF-8).

A possible candidate would be "¦".

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


7,484 views.

Posting of new messages is disabled at present.

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.