[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]  General
. . -> [Subject]  Omit extra blank lines

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Omit extra blank lines

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


Pages: 1  2 

Posted by Digs   USA  (17 posts)  [Biography] bio
Date Reply #15 on Thu 14 Jun 2012 12:22 AM (UTC)  quote  ]
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>

[Go to top] top

Posted by Worstje   Netherlands  (867 posts)  [Biography] bio
Date Reply #16 on Thu 14 Jun 2012 11:02 AM (UTC)  quote  ]
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?
[Go to top] top

Posted by Digs   USA  (17 posts)  [Biography] bio
Date Reply #17 on Thu 14 Jun 2012 05:16 PM (UTC)  quote  ]
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. ;-)
[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,097 views.

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

[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]