public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Re: [PATCH] Strange behavior of cmd.exe when hammered with clear  screen operations from Cygwin program.
@ 2016-07-28 19:44 Kaz Kylheku
  2016-07-28 19:51 ` Kaz Kylheku
  2016-07-28 19:59 ` Corinna Vinschen
  0 siblings, 2 replies; 18+ messages in thread
From: Kaz Kylheku @ 2016-07-28 19:44 UTC (permalink / raw)
  To: Corinna Vinschen; +Cc: cygwin

On 28.07.2016 00:08, Corinna Vinschen wrote:
> Thanks for testing.  I'll check in the patch as is for now, but I'd
> still be interested to fix the aforementioned empty lines problem,
> even if just for completeness.  If you have an idea, feel free to
> propose.

Hi Corinna,

The blank lines above the cursor position, as well as any
that are below, are entering into the history simply because they
are part of the window content being saved. Any non-blank lines
in their place would be expected to be saved, and no processing
takes place to distinguish blank from non-blank.

One way to address this is to basically scan the entire window
portion of the buffer for trailing blank lines and trim the buffer
to exclude them. Then scroll by the amount of remaining lines
lines, to usher them into the history.

Finally, restore the cursor position.

Or, perhaps, two or more trailing blank lines in the window could be
condensed down to one which does get saved, so the separation
is not misleadingly condensed down to nothing.

However, there are possible arguments against trimming blank
lines which are above the cursor position. Say the window
contains this:

    +---
    | nonblank
    | blank
    | blank
    | > [] cursor
    | blank
    | blank
    | blank
    +---

It's uncontroversial to obliterate the three blank lines below the
cursor. However the blank lines between the nonblank line and
the cursor could be semantic; the user might want them in the
scrollback history "as is".

The leading nonblank line is a red herring; even if all the
lines above the cursor are blank, the reasoning applies.



--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 18+ messages in thread
* Strange behavior of cmd.exe when hammered with clear screen  operations from Cygwin program.
@ 2016-07-27  5:19 Kaz Kylheku
  2016-07-27 13:09 ` Kaz Kylheku
  0 siblings, 1 reply; 18+ messages in thread
From: Kaz Kylheku @ 2016-07-27  5:19 UTC (permalink / raw)
  To: Cygwin

The test program featured below works fine under
the Cygwin console window.

If executed from a cmd.exe console, strange things happen with the
cmd.exe window. Suddenly, the window spontaneously resizes so that
is taller than the desktop. A horizontal scrollbar may appear in it
also, as well as an unpainted area through which the desktop is
visible. As soon as you try to grab the title bar to resize it, it
disappears. It hasn't quit; it is actually minimized. You can
maximize it from the task bar and then resize the tall window to
its original shape.

This is using 32 bit Cygwin 2.5.2, on 64 bit Win 7.

All the program does is hammer Cygwin's VT100 emulation code
with the clear screen escape sequence: ESC [ 2 J.

A 1000 iterations are more than enough to reproduce it;
I made it 10000.

If we change it to 100, some interesting variations
occur. It may take multiple runs of the program to reproduce
a problem. Then, suddenly, the window might shrink vertically
On a subsequent run, it might shrink again. In these situations,
it remains susceptible to a manual resize without
disappearing.


#include <stdio.h>

int main(void)
{
   int i;

   for (i = 0; i < 10000; i++) {
     fputs("\x1b[2J", stdout);
     fflush(stdout);
   }

   return 0;
}



--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2016-08-03 12:41 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-28 19:44 [PATCH] Strange behavior of cmd.exe when hammered with clear screen operations from Cygwin program Kaz Kylheku
2016-07-28 19:51 ` Kaz Kylheku
2016-07-28 19:59 ` Corinna Vinschen
2016-07-28 20:21   ` Corinna Vinschen
2016-07-29 13:25   ` Corinna Vinschen
2016-07-29 20:51     ` Kaz Kylheku
2016-07-29 21:03       ` Kaz Kylheku
2016-08-01  8:51       ` Corinna Vinschen
2016-08-03 11:55         ` Kaz Kylheku
2016-08-03 12:41           ` Kaz Kylheku
2016-08-03 16:53           ` Corinna Vinschen
  -- strict thread matches above, loose matches on Subject: below --
2016-07-27  5:19 Kaz Kylheku
2016-07-27 13:09 ` Kaz Kylheku
2016-07-27 14:32   ` [PATCH] " Kaz Kylheku
2016-07-27 14:35     ` Kaz Kylheku
2016-07-27 15:40       ` Kaz Kylheku
2016-07-27 18:45         ` Corinna Vinschen
2016-07-27 20:36           ` Kaz Kylheku
2016-07-27 21:30             ` Kaz Kylheku
2016-07-28  8:00             ` Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).