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 ➜ General ➜ Omit extra blank lines

Omit extra blank lines

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


Pages: 1  2 

Posted by Digs   USA  (17 posts)  Bio
Date Reply #15 on Thu 14 Jun 2012 12:22 AM (UTC)
Message
Success! Thanks for the help.

This plugin omits extra blank lines from the output window (excluding blank lines generated from notes). For instance, if there are 3 blank lines in a row, it will remove 2 of them.


<?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"
   version="1.1"
   >
<description trim="y">
<![CDATA[
Omits extra blank lines from output.
For example, given 3 blank lines in a row, 2 will be deleted.
]]>
</description>

</plugin>

<triggers>
  <trigger
   enabled="n"
   match="^$"
   name="omit_blank"
   omit_from_output="y"
   regexp="y"
   sequence="1"
  >
  </trigger>
</triggers>

<script>
<![CDATA[

function OnPluginScreendraw (type, log, line)
  if line == "" then
    EnableTrigger("omit_blank", true)
  else
    EnableTrigger("omit_blank", false)
  end
end

]]>
</script> 

</muclient>

Top

Posted by Worstje   Netherlands  (899 posts)  Bio
Date Reply #16 on Thu 14 Jun 2012 11:02 AM (UTC)
Message
Nice. I hadn't even considered OnPluginScreenDraw. However, what does that behave like when you scroll up and down, pgup, pgdown and so forth?
Top

Posted by Digs   USA  (17 posts)  Bio
Date Reply #17 on Thu 14 Jun 2012 05:16 PM (UTC)
Message
Performance is great - no issues.

The OnPluginScreenDraw callback is in the same line processing chain as OnPluginLineReceived and trigger matching (see http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=6554). It has an added performance benefit because it's only called once per visible line (including notes and commands), unlike OnPluginLineReceived and triggers which process every incoming line.

It does appear that OnPluginScreenDraw is called too late to do anything with the current line, but it works just fine to enable a line-omitting trigger for the following line. ;-)
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.


77,281 views.

This is page 2, subject is 2 pages long:  [Previous page]  1  2 

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.