Fix wineconsole curses bugs

Jukka Heinonen jhei at iki.fi
Sat May 24 08:30:49 CDT 2003


After this patch, it is possible to use wineconsole
curses backend even if your unix terminal is smaller than
user backend size. Previously too large screen dimensions were
passed to prefresh() which made curses stop updating the 
terminal. Also, cursor no longer jumps into wrong place
after printing stuff to screen.




Changelog:
  Wineconsole curses backend now works even if
  terminal is smaller than console size. Cursor
  is no longer left into wrong location after screen
  updates.




Index: programs/wineconsole/curses.c
===================================================================
RCS file: /home/wine/wine/programs/wineconsole/curses.c,v
retrieving revision 1.7
diff -u -r1.7 curses.c
--- programs/wineconsole/curses.c	3 Apr 2003 23:57:39 -0000	1.7
+++ programs/wineconsole/curses.c	24 May 2003 13:20:50 -0000
@@ -25,6 +25,8 @@
  *   functions which can be implemented as macros)
  * - finish buffer scrolling (mainly, need to decide of a nice way for 
  *   requesting the UP/DOWN operations
+ * - Resizing (unix) terminal does not change (Win32) console size.
+ * - Initial console size comes from registry and not from terminal size.
  */
 
 #include "config.h"
@@ -60,6 +62,7 @@
     int                 allow_scroll;
 };
 
+
 /******************************************************************
  *		WCCURSES_ResizeScreenBuffer
  *
@@ -83,6 +86,11 @@
  */
 static void	WCCURSES_PosCursor(const struct inner_data* data)
 {
+    int scr_width;
+    int scr_height;
+
+    getmaxyx(stdscr, scr_height, scr_width);
+
     if (data->curcfg.cursor_visible &&
         data->cursor.Y >= data->curcfg.win_pos.Y &&
         data->cursor.Y < data->curcfg.win_pos.Y + data->curcfg.win_height &&
@@ -96,9 +104,10 @@
     {
         curs_set(0);
     }
+
     prefresh(PRIVATE(data)->pad,
              data->curcfg.win_pos.Y, data->curcfg.win_pos.X,
-             0, 0, data->curcfg.win_height, data->curcfg.win_width);
+             0, 0, scr_height, scr_width);
 }
 
 /******************************************************************
@@ -147,7 +156,7 @@
 }
 
 /******************************************************************
- *		Refresh
+ *		WCCURSES_Refresh
  *
  *
  */
@@ -179,9 +188,8 @@
         }
         mvwaddchnstr(PRIVATE(data)->pad, y, 0, PRIVATE(data)->line, data->curcfg.sb_width);
     }
-    prefresh(PRIVATE(data)->pad,
-             data->curcfg.win_pos.Y, data->curcfg.win_pos.X,
-             0, 0, data->curcfg.win_height, data->curcfg.win_width);
+
+    WCCURSES_PosCursor(data);
 }
 
 /******************************************************************



-- 
Jukka Heinonen <http://www.iki.fi/jhei/>



More information about the wine-patches mailing list