[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]  Using the "\x1b[2J\x1b[H" Screen Clear Control Sequence with MUSHClient

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?
(New message)
Subject: Using the "\x1b[2J\x1b[H" Screen Clear Control Sequence with MUSHClient
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)

Pages: 1 2  

Posted by Nick Gammon   Australia  (18,772 posts)  [Biography] bio   Forum Administrator
Date Tue 11 Jan 2011 08:48 AM (UTC)  quote  ]
Message
Whoops, didn't notice this was page 2 of an old thread. In that case, my earlier comments apply as well. :)

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (18,772 posts)  [Biography] bio   Forum Administrator
Date Tue 11 Jan 2011 08:45 AM (UTC)  quote  ]
Message
Certainly you could do that in a plugin. Search for examples using the plugin callback OnPluginPacketReceived.

You would need to use that because control sequences are processed by the client (however not before OnPluginPacketReceived is called).

A simple method would be to search for the string you mention, and then display a dozen or so blank lines. A more complex method would find the number of pixels in the output font height (using GetInfo) and the number of pixels in the output window, and calculate the number of lines you needed.

However I'm not sure it is really a great idea. If the screen clears often (eg. when you change rooms) then the output buffer is going to fill up rather quickly with annoying numbers of blank lines.

Still, you can do it if you want to.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Radyth   (1 post)  [Biography] bio
Date Mon 10 Jan 2011 10:20 PM (UTC)  quote  ]
Message
Couldn't you just make mushclient interpret that sequence to scroll the window so all of the output that's received after it is displayed at the top of the screen? is there a way to do this with a plugin?
[Go to top] top

Posted by Twisol   USA  (2,229 posts)  [Biography] bio
Date Thu 22 Oct 2009 12:22 AM (UTC)  quote  ]
Message
Ah, okay. Just curious :)

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by Nick Gammon   Australia  (18,772 posts)  [Biography] bio   Forum Administrator
Date Wed 21 Oct 2009 09:47 PM (UTC)  quote  ]
Message
Twisol said:


EDIT: Hey, Nick, what's the difference between GetInfo(241) and GetInfo(112)? I get the same number for each, and their descriptions seem pretty similar too:

Quote:

212 - Output font height
241 - The height, in pixels, of a character in the output window, in the current output font.



They are the same variable. It seems when I added 241, I didn't notice I already had done that.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Twisol   USA  (2,229 posts)  [Biography] bio
Date Wed 21 Oct 2009 09:22 PM (UTC)  quote  ]

Amended on Wed 21 Oct 2009 09:24 PM (UTC) by Twisol

Message
Shadowfyr said:
Wait.. If that is the entire buffer, then... Wouldn't it make more sense to have a "get size of output window", divide that by the height of the character, then only use "note()" to generate as many lines as needed for the window?


Isn't that exactly what I did? :P

EDIT: Okay, I said "output buffer height". I suppose that could be construed as "size of the whole buffer", but it's not; I meant the visible part, i.e. the output window. Try it, it works.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by Shadowfyr   USA  (1,774 posts)  [Biography] bio
Date Wed 21 Oct 2009 07:46 PM (UTC)  quote  ]
Message
Wait.. If that is the entire buffer, then... Wouldn't it make more sense to have a "get size of output window", divide that by the height of the character, then only use "note()" to generate as many lines as needed for the window?

In any case, we do have the code now, so maybe it would just be more effective if we found someone that had an idea how to implement a real fix.

main {
__if (Schrodinger_Cat is Alive or version >= "XP"){
____if version = "Vista" then Performance /= Number_of_Cores;
____call Functional_Code();}
__else
____call Crash_Windows();}
[Go to top] top

Posted by Twisol   USA  (2,229 posts)  [Biography] bio
Date Wed 21 Oct 2009 01:00 AM (UTC)  quote  ]

Amended on Wed 21 Oct 2009 01:12 AM (UTC) by Twisol

Message
Here's a simple solution I came up with (for Lua, but the premise is the same in any other language)

for i=0,GetInfo(280)/GetInfo(241) do
  Note()
end


GetInfo(280) returns the current output buffer height, in pixels. GetInfo(241) returns the height of a single character in the buffer. Division results in the number of lines visible on-screen. Note() that many times... voila, clean slate.


EDIT: Hey, Nick, what's the difference between GetInfo(241) and GetInfo(112)? I get the same number for each, and their descriptions seem pretty similar too:

Quote:

212 - Output font height
241 - The height, in pixels, of a character in the output window, in the current output font.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by Nick Gammon   Australia  (18,772 posts)  [Biography] bio   Forum Administrator
Date Wed 21 Oct 2009 12:14 AM (UTC)  quote  ]
Message
Cage_fire_2000 said:

Again, this might tick some people off that they're losing all their scrollback.


Most people.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Cage_fire_2000   USA  (119 posts)  [Biography] bio
Date Tue 20 Oct 2009 08:24 PM (UTC)  quote  ]
Message
Well, it'd be possible/simple enough to make a plugin to clear the screen when the client receives that code, just by processing the incoming lines/packets. and then calling DeleteOutput() Again, this might tick some people off that they're losing all their scrollback.

Heck, I was just recently thinking if the client somehow remembered unsupported escape codes(maybe somehow in the style info or something?) or if you directly processed incoming packets/lines(also allowing it to go through regular processing so it'd still show up in scrollback) that it'd be possible if somebody had the time and motivation to actually code it to create a plugin to do terminal emulation in a miniwindow. You could create a miniwindow the size of the output window or maybe a bit smaller, maybe add a close/minimize button to the side and just draw the output to it allowing you to handle escape codes however you want while still retaining scrollback in the main window underneath. I don't think it'd be /total/ emulation, but it'd get the main stuff like clear screen, cursor movement, heck with the help of a timer, maybe even blinking that people have been wanting so long, etc. It'd be quite a bit of work though, so good luck to anybody who wants to go about it.

[Go to top] top

Posted by Xtian   (53 posts)  [Biography] bio
Date Sun 18 Oct 2009 04:14 PM (UTC)  quote  ]
Message
To the original author: On the server side you could try to get the terminal-height (this is a telnet-negotiation) of the client and send that amount of Newlines.
It wouldnt put the next line on the top of the screen and would be kind of a workaround for Mushclient, but you would have "cleared" it in a way.
[Go to top] top

Posted by Shadowfyr   USA  (1,774 posts)  [Biography] bio
Date Sat 17 Oct 2009 04:16 AM (UTC)  quote  ]
Message
Hmm. Forget to set the second one to the correct author? ;) lol

But, yeah. That does represent an issue. Not sure "much more complicated" is accurate, but definitely not as simple as it was. The real question is, "how much more?". But, yeah.

main {
__if (Schrodinger_Cat is Alive or version >= "XP"){
____if version = "Vista" then Performance /= Number_of_Cores;
____call Functional_Code();}
__else
____call Crash_Windows();}
[Go to top] top

Posted by Nick Gammon   Australia  (18,772 posts)  [Biography] bio   Forum Administrator
Date Fri 16 Oct 2009 03:55 AM (UTC)  quote  ]

Amended on Sat 17 Oct 2009 04:23 AM (UTC) by Nick Gammon

Message
Shadowfyr said:

Yeah, we have gone over this before and not gotten much cooperation.


This is mainly because of the design issues.

Kayle said:

As an aside, GMud handles it in a much more.. grotesque manner, even going so far as to display a partially parsed version of the sequence.


So, MUSHclient isn't the only one that isn't cooperating?

OK, let's imagine that, as part of this menu sequence, a few menus appear in quick succession. As you scroll back, then if a particular menu is going to appear "on a blank screen", then it follows that each menu should do that, so what was once a nice screenful showing what you received is now truncated down to one menu at a time, with them flickering on and off as you scroll back.

I honestly think it would look ugly. Then you have the issue that when you click on the screen to select something, the calculations which relate the pixel position to somewhere in the buffer become much more complex.

[EDIT] Fixed second quote's author.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Shadowfyr   USA  (1,774 posts)  [Biography] bio
Date Wed 14 Oct 2009 08:29 PM (UTC)  quote  ]
Message
Yeah, we have gone over this before and not gotten much cooperation. lol Most telnet style clients that *support* this, and still maintain a back buffer, tend to treat the command like a "page break", much as word treats it. Scrolling won't "lose" the prior page, it just shifts the entire contents of the window up, so the next page starts at the top, or down, so that the "end" of the last page is on the last window line, as you scroll. The actual buffer is still intact.

Text positioning stuff, like moving the cursor, tends to work similarly, but it either a) presumes that you have a fixed window size, so knows how much will be "on screen" during the operation to save the result *or* b) any line that scrolls off the visible screen becomes "fixed" in the state it had at that moment. Its up to the server end to make sure that it isn't trying to change characters on a line that isn't there anymore.

Of these two, tracking a page break is probably fairly simple, since it only effects what is visibly on the screen, not the buffer, and thus shouldn't be a problem. If someone is trying to muck with some line that isn't any longer displayed, then its going to get pulled from the buffer anyway, not the visible screen, right? I never saw the problem here.

main {
__if (Schrodinger_Cat is Alive or version >= "XP"){
____if version = "Vista" then Performance /= Number_of_Cores;
____call Functional_Code();}
__else
____call Crash_Windows();}
[Go to top] top

Posted by Nick Gammon   Australia  (18,772 posts)  [Biography] bio   Forum Administrator
Date Wed 14 Oct 2009 07:59 PM (UTC)  quote  ]
Message
Well it would throw out the logic that translates physical lines (ie. when you click with the mouse) to where they are in the output buffer.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[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.


7,512 views.

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

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