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
➜ General
➜ Trimming Whitespace from the Ends of Lines
Trimming Whitespace from the Ends of Lines
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| ShayCaron
USA (1 post) Bio
|
Date
| Thu 28 Sep 2006 05:56 AM (UTC) |
Message
| On a MUSH I frequent, some of the commands return extra whitespace at the ends of the lines, which makes the text wrap strangely on my screen. So I attempted to make a trigger that finds whitespace at the end of a line and omits that whitespace from output and from the log.
Trigger: \s+$
x Omit from log file
x Omit from output
x Regular expression
Unfortunately, that omits the entire *line* from the log/output, which definitely isn't what I need. Any suggestions on how I could get the effect I'm looking for? | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #1 on Thu 28 Sep 2006 07:28 AM (UTC) Amended on Thu 28 Sep 2006 10:08 AM (UTC) by Nick Gammon
|
Message
| Try installing this small plugin - it filters incoming text, removing trailing spaces before a carriage-return/linefeed:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Thursday, September 28, 2006, 5:15 PM -->
<!-- MuClient version 3.80 -->
<!-- Plugin "Trim_White_Space" generated by Plugin Wizard -->
<muclient>
<plugin
name="Trim_White_Space"
author="Nick Gammon"
id="d9e7095fb1062a2504c79118"
language="Lua"
purpose="Trims whitespace at end of lines"
date_written="2006-09-28 17:13:19"
requires="3.67"
version="1.0"
>
</plugin>
<!-- Script -->
<script>
<![CDATA[
function OnPluginPacketReceived (s)
return (string.gsub (s, " +\r?\n", "\n"))
end -- function OnPluginPacketReceived
]]>
</script>
</muclient>
Just save the above text as Trim_White_Space.xml, put it into the plugins directory (in the MUSHclient installation directory), and then use the File -> Plugins to load it. |
- 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.
8,203 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top