[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Suggestions
. . -> [Subject]  Copy and pasting lines with \n into prompt

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?
(New message)
Subject: Copy and pasting lines with \n into prompt
Name:
Your forum user name.
Register forum user name
Password:
Your forum password.
Forgotten password?
Message:
Message to be posted (in English, please)
Maximum of 6000 characters. Text only please, no HTML.
Forum codes:
Check this if your message uses 'forum codes' or templates (auto-detected for new posts).
Forum codes Templates

Save this message ...


Subject review (reverse sequence)

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Tue 08 Jul 2008 02:44 AM (UTC)  quote  ]
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
[Go to top] top

Posted by Artel   USA  (63 posts)  [Biography] bio
Date Tue 08 Jul 2008 02:13 AM (UTC)  quote  ]
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.
[Go to top] top

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Sun 06 Jul 2008 03:01 AM (UTC)  quote  ]
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
[Go to top] top

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Sun 06 Jul 2008 02:57 AM (UTC)  quote  ]
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
[Go to top] top

Posted by Artel   USA  (63 posts)  [Biography] bio
Date Sun 06 Jul 2008 01:07 AM (UTC)  quote  ]
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.
[Go to top] 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.


1,940 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]