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
➜ Suggestions
➜ Copy and pasting lines with \n into prompt
Copy and pasting lines with \n into prompt
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Artel
USA (65 posts) Bio
|
Date
| Sun 06 Jul 2008 01:07 AM (UTC) |
Message
| When using my mud's note system, I frequently use a external text editor to type longer messages. I intentionally set that text editor to treat newlines as \n instead of \r\n (because I even though I use a Windows machine, I frequently work with source code that comes from Linux developers and servers.) However, when I copy and paste stuff from the text editor to the MUSHclient prompt, all of the newlines show up as little squares instead of newlines. If it's not too difficult, it would be nice to have them show up as newlines.
Also, the same issue occurs when using \r instead of \r\n.
Using MUSHclient 4.30. |
Artel. | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #1 on Sun 06 Jul 2008 02:57 AM (UTC) |
Message
| It is a bit fiddly to do that, because the command window is an edit control, and I don't get notified when you paste into it. However you can run the (Lua) script below (eg. at world open time):
AcceleratorTo ("F8", [[ do
local line = GetCommand ()
line = string.gsub (line, "\r\n", "\n")
line = string.gsub (line, "\r", "\n")
line = string.gsub (line, "\n", "\r\n")
PushCommand ()
SetCommand (line)
end
]], sendto.script)
Then once you have pasted some problem code into the command window, hit F8 and it will be fixed.
What it does is:
- Gets the command window contents
- Converts \r\n (normal DOS line endings) into straight \n
- Converts \r (Mac line endings) into \n
- Converts the resulting \n endings into normal DOS endings: \r\n
- Puts it back into the command window.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #2 on Sun 06 Jul 2008 03:01 AM (UTC) |
Message
| The other option is to use MUSHclient's internal text editor. Amongst other things it has an option to convert line endings (see Convert menu). |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Artel
USA (65 posts) Bio
|
Date
| Reply #3 on Tue 08 Jul 2008 02:13 AM (UTC) |
Message
| Thank you Nick, the Lua script method will work for me.
Is there a way to make it auto run whenever I open any world? Or is the best way to just make this script a plugin and add it to all of my world? |
Artel. | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #4 on Tue 08 Jul 2008 02:44 AM (UTC) |
Message
| For any world, make it a plugin, and then add that to Global Options -> Plugins, and make that a default plugin to load. |
- 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.
16,435 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top