This is the mail archive of the cygwin-developers@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Terminal handling with the 990809 snapshot


>>> On Wed, 18 Aug 1999 04:29:15 -0400
>>> Glenn Spell <glenn@gs.fay.nc.us> said:

> If you were to resubmit your patch against the current snapshot,
> would it look something like this?

There are a few problems.  Handling of CR should also revert to
the previous behavior. My previous patch has a bug on a console
with a scroll buffer on WinNT.

The following is a patch against the 1999-Aug-14 snapshot.

--- fhandler_console.cc-	Fri Aug 06 10:28:23 1999
+++ fhandler_console.cc	Wed Aug 18 21:17:53 1999
@@ -34,7 +34,7 @@ static struct
     } scroll_region = {0, -1};
 
 #define srTop (info.winTop + scroll_region.Top)
-#define srBottom (info.winTop + scroll_region.Bottom)
+#define srBottom ((scroll_region.Bottom < 0) ? info.winBottom : info.winTop + scroll_region.Bottom)
 
 #define use_tty ISSTATE (myself, PID_USETTY)
 
@@ -195,9 +195,6 @@ fhandler_console::fillin_info (void)
       info.winBottom = 24;
     }
 
-  if (scroll_region.Bottom < 0)
-    scroll_region.Bottom = info.dwWinSize.Y - 1;
-
   return ret;
 }
 
@@ -991,14 +988,19 @@ fhandler_console::write_normal (const un
 	  break;
 	case DWN:		/* WriteFile("\n") always adds CR... */
 	  cursor_get (&x, &y);
-	  WriteFile (get_output_handle (), "\n", 1, &done, 0);
-	  if (get_w_binary ())
-	    cursor_rel (x, 0);
-	  if (y == srBottom && y < info.winBottom)
+	  if (y == srBottom)
 	    {
-	      scroll_screen (0, srTop + 1, -1, srBottom, 0, srTop);
-	      cursor_set (FALSE, x, y);
+	      if (y < info.winBottom || scroll_region.Top)
+		{
+		  scroll_screen (0, srTop + 1, -1, srBottom, 0, srTop);
+		  y--;
+		}
+	      else
+		WriteFile (get_output_handle (), "\n", 1, &done, 0);
 	    }
+	  if (!get_w_binary ())
+	    x = 0;
+	  cursor_set (FALSE, x, y + 1);
 	  break;
 	case BAK:
 	  cursor_rel (-1, 0);
@@ -1007,6 +1009,9 @@ fhandler_console::write_normal (const un
 	  cursor_rel (1, 0);
 	  break;
 	case CR:
+	  cursor_get (&x, &y);
+	  cursor_set (FALSE, 0, y);
+	  break;
 	case ERR:
 	  WriteFile (get_output_handle (), src, 1, &done, 0);
 	  break;

____
  | AIST      Kazuhiro Fujieda <fujieda@jaist.ac.jp>
  | HOKURIKU  School of Information Science
o_/ 1990      Japan Advanced Institute of Science and Technology

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]