Looking back over the posts, I think this subject has become a bit muddied. My bad. Sorry that I made you insane Worstje. I shouldn't post when I'm tired. :-)
To clarify, there are several distinct but related points:
#1. I never want more than one visible blank line between the lines of text in the output window.
#2. I'd like to be able to match all visible lines of text in the output window.
#3. My modified Aardwolf_Consider_Window plugin is causing extra blank lines to appear in the output window.
Point #1:
As mentioned, extra blank lines in the output can be caused by a number of things. While it would be ideal to always fix the cause instead of the symptom, that is not always easy or possible. I think Nick Gammon validated this point of view when he made his Omit_Blank_Lines plugin (http://www.gammon.com.au/forum/?id=8768). It works perfectly, but I prefer normal spacing.
The dual trigger example in post 6 is an ugly hack. I only posted it because an example was requested. While somewhat functional, it was a bad choice for discussion.
If point #2 can be addressed, then point #1 will be easily dealt with.
Point #2:
Is there a way to match all visible non-blank lines? The pattern ".+" matches both visible and omitted lines.
@Fiendish: I'm not trying to remove any lines in the example in post 5. I was showing that ".+" matches both visible and omitted lines, so it won't work as a solution for point #1.
Points #1 & #2, Example:
Here's a good, clean example of a plugin that attempts to omit extra blank spaces. It doesn't work because the third trigger named "not_a_blank_line" matches both visible and omitted lines. If you don't have any extra blank spaces to test this with, see the example for point #3.
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Tuesday, June 12, 2012, 9:29 AM -->
<!-- MuClient version 4.81 -->
<!-- Plugin "Omit_Extra_Blank_Lines" generated by Plugin Wizard -->
<muclient>
<plugin
name="Omit_Extra_Blank_Lines"
author="Digs"
id="9742160fe2a5ccb8e35478f1"
language="Lua"
purpose="Omits extra blank lines from output."
date_written="2012-06-12 09:29:45"
requires="4.81"
version="1.0"
>
<description trim="y">
<![CDATA[
Omits extra blank lines from output.
NOTE: The option "File > Global Preferences > Regular expressions can match on an empty string",
must be checked.
]]>
</description>
</plugin>
<!-- Get our standard constants -->
<include name="constants.lua"/>
<!-- Triggers -->
<triggers>
<trigger
enabled="y"
match="^$"
name="first_blank_line"
regexp="y"
script="start_omitting_blank_lines"
send_to="12"
sequence="2"
>
</trigger>
<trigger
enabled="n"
keep_evaluating="n"
match="^$"
name="gag_blank_lines"
omit_from_output="y"
regexp="y"
sequence="1"
>
</trigger>
<trigger
enabled="n"
keep_evaluating="y"
match="."
name="not_a_blank_line"
regexp="y"
script="stop_omitting_blank_lines"
send_to="12"
sequence="10000"
>
</trigger>
</triggers>
<script>
<![CDATA[
function start_omitting_blank_lines ()
EnableTrigger("gag_blank_lines", true)
EnableTrigger("not_a_blank_line", true)
end
function stop_omitting_blank_lines ()
EnableTrigger("gag_blank_lines", false)
EnableTrigger("not_a_blank_line", false)
end
]]>
</script>
</muclient>
Point #3
The Aardwolf_Consider_Window plugin uses this line in its code: Send ("echo nhm"). This is rather spammy, so I changed it to: SendNoEcho ("echo nhm"). The plugin triggers on this echo to refresh its window, and it does this often with the setting "conw auto". The echo is omitted, but strangely a blank line is left behind. Use the following example to easily reproduce this behavior (change the first trigger's match to something reproducible). Thoughts?
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Tuesday, June 12, 2012, 11:17 AM -->
<!-- MuClient version 4.81 -->
<!-- Plugin "EchoTest" generated by Plugin Wizard -->
<muclient>
<plugin
name="EchoTest"
author="Digs"
id="7d2b31fb5db49f949d802307"
language="Lua"
purpose="TEST: SendNoEcho + omit the echo = extra space in output."
save_state="y"
date_written="2012-06-12 11:14:05"
requires="4.81"
version="1.0"
>
<description trim="y">
<![CDATA[
Send an echo with SendNoEcho.
Omit the echo.
There is then an extra space in the output window.
]]>
</description>
</plugin>
<!-- Get our standard constants -->
<include name="constants.lua"/>
<!-- Triggers -->
<triggers>
<trigger
enabled="y"
keep_evaluating="y"
match="^[ Exits"
regexp="y"
script="send_echo"
send_to="12"
sequence="100"
>
</trigger>
<trigger
enabled="y"
keep_evaluating="n"
match="^EchoTest$"
omit_from_output="y"
regexp="y"
sequence="100"
>
</trigger>
</triggers>
<script>
<![CDATA[
function send_echo ()
SendNoEcho ("echo EchoTest")
end
]]>
</script>
</muclient>
|