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 ➜ WindowText can't display newlines

WindowText can't display newlines

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


Posted by Fiendish   USA  (2,555 posts)  Bio   Global Moderator
Date Wed 30 Mar 2011 10:17 AM (UTC)

Amended on Wed 30 Mar 2011 11:37 AM (UTC) by Fiendish

Message
If you use WindowText to display a string that has newlines in it, they show as boxes. This doesn't seem appropriate. If we can't have them actually work, then it'd at least be better to just not show those box characters.

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

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Wed 30 Mar 2011 08:51 PM (UTC)
Message
Well for one thing I can't reproduce that after trying a couple of fonts:


win = "test_" .. GetPluginID ()  
WindowCreate (win, 0, 0, 180, 80, miniwin.pos_center_all, 0, 0xFFFFFF)
WindowFont (win, "f", "Helvetica", 10, true) -- define font
WindowText ( win, "f" , "Hello, world\n", 10, 10, 0, 0, 0, 0)
WindowShow (win,  true)  -- show it 


Result:



No doubt it does it for some of them, otherwise you wouldn't have reported it.

For another thing, some fonts actually take the opportunity to use those "non-printable" positions to slip in some graphical characters, which might be useful. For example:


win = "test_" .. GetPluginID ()  
WindowCreate (win, 0, 0, 380, 80, miniwin.pos_center_all, 0, 0xFFFFFF)
WindowFont (win, "f", "Helvetica", 10, true) -- define font

x = 10
for i = 0, 32 do
  x = x + WindowText ( win, "f" , string.char (i), x, 10, 0, 0, 0, 0)
end
WindowShow (win,  true)  -- show it 


Result:



So if I suppress character 10 just because it makes a box you don't like, then that will drop one of those graphic characters from your ability to display them. Why do that?

WindowText is an interface to the low-level character drawing routines. It doesn't claim to handle newlines or to suppress them. However I'll update the documentation to make that clearer.

- Nick Gammon

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

Posted by Fiendish   USA  (2,555 posts)  Bio   Global Moderator
Date Reply #2 on Thu 31 Mar 2011 04:57 AM (UTC)
Message
Quote:
Well for one thing I can't reproduce that after trying a couple of fonts:

Odd. Well, it's not a huge deal anyway. As ever, I just reconsidered what I was trying to do and worked around my misunderstanding of the function. It turns out that just keeping the newlines in place would have broken what I was trying to do anyway (more updates to the Aardwolf chat capture window).

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.


9,230 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.