lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

LYNX-DEV lynx-2.7ac-0.6-color3.patch


From: T.E.Dickey
Subject: LYNX-DEV lynx-2.7ac-0.6-color3.patch
Date: Tue, 18 Mar 1997 19:59:10 -0500 (EST)

lynx (color patch #3) - 1997/3/18 - T.Dickey <address@hidden>

This patch makes Lynx+ncurses display forms correctly.  (There's a longstanding
difference - since at least 1.9.8a - between ncurses' order of refreshing
subwindows when compared with SVr4 curses).  The particular problem in this
case is that a getch() causes the stdscr to be refreshed, overwriting the
form_window.  I introduced a temporary variable that overrides the stdscr
while the form is being processed.

The other changes are applicable to SVr4 curses, or harmless with other curses,
such as using wprintw to get trailing blanks, forcing the color of the
highlighted bar.  (I'm not certain about the need for wbkgd() with SVr4, and
it'd have to be ifdef'd for COLOR_CURSES anyway).

I compared the display with slang; it looks the same to me.

--------------------------------------------------------------------------------
 LYForms.c   |   13 ++++++++++---
 LYStrings.c |   35 +++++++++++++++++++++++++++++------
 2 files changed, 39 insertions, 9 deletions
--------------------------------------------------------------------------------
Index: src/LYForms.c
--- lynx-2.7ac-0.6+/src/LYForms.c       Sun Mar  9 17:10:20 1997
+++ lynx-2.7ac-0.6-color3/src/LYForms.c Tue Mar 18 19:27:09 1997
@@ -509,6 +509,10 @@
         return(orig_selection);
     }
     scrollok(form_window, TRUE);
+#ifdef NCURSES
+    LYsubwindow(form_window);
+    wbkgd(form_window, getbkgd(stdscr));
+#endif
 #else
     SLsmg_fill_region (top, lx - 1, bottom - top, width + 4, ' ');
 #endif /* !USE_SLANG */
@@ -539,7 +543,7 @@
 #ifndef USE_SLANG
            wmove(form_window,(i+1)-window_offset,2);
            wclrtoeol(form_window);
-           waddstr(form_window,opt_ptr->name);
+           wprintw(form_window, "%-*s", width, opt_ptr->name);
 #else
            SLsmg_gotorc (top + (i+1)-window_offset, lx - 1 + 2);
            SLsmg_write_nstring (opt_ptr->name, width);
@@ -569,7 +573,7 @@
        if (opt_ptr != NULL) {
 #ifndef USE_SLANG
            wmove(form_window,(i+1)-window_offset,2);
-            waddstr(form_window,opt_ptr->name);
+            wprintw(form_window, "%-*s", width, opt_ptr->name);
 #else
            SLsmg_gotorc (top + (i+1)-window_offset, lx - 1 + 2);
            SLsmg_write_nstring (opt_ptr->name, width);
@@ -584,7 +588,7 @@
 #ifndef USE_SLANG
         wstart_reverse(form_window);
         wmove(form_window,(i+1)-window_offset,2);
-        waddstr(form_window,opt_ptr->name);
+        wprintw(form_window, "%-*s", width, opt_ptr->name);
         wstop_reverse(form_window);
         wrefresh(form_window);
 #else
@@ -1047,6 +1051,9 @@
     }
 #ifndef USE_SLANG
     delwin(form_window);
+#ifdef NCURSES
+    LYsubwindow(0);
+#endif
 #endif /* !USE_SLANG */
     refresh();
 
Index: src/LYStrings.c
--- lynx-2.7ac-0.6+/src/LYStrings.c     Sun Mar  9 15:48:08 1997
+++ lynx-2.7ac-0.6-color3/src/LYStrings.c       Tue Mar 18 19:13:16 1997
@@ -73,26 +73,49 @@
 }
 #endif /* EXP_CHARTRANS */
 
+#undef GetChar
+
+#undef GetChar
+
 #ifdef USE_SLANG
 #ifdef VMS
 #define GetChar() ttgetc()
 #else
 #define GetChar (int)SLang_getkey
 #endif /* VMS */
-#else /* Not slang: */
+#endif /* USE_SLANG */
+
+#if !defined(GetChar) && defined(NCURSES)
+#define GetChar() wgetch(my_subwindow ? my_subwindow : stdscr)
+#endif
+
+#if !defined(GetChar) && defined(SNAKE)
+#define GetChar() wgetch(stdscr)
+#endif
+
+#if !defined(GetChar)
 #ifdef VMS
 #define GetChar() ttgetc()
 #else
-#if defined(SNAKE) || defined(NCURSES)
-#define GetChar() wgetch(stdscr)
-#else /* everything but VMS, SNAKE and NCURSES */
 #ifndef USE_GETCHAR
 #define USE_GETCHAR
 #endif /* !USE_GETCHAR */
 #define GetChar() getchar()  /* used to be "getc(stdin)" and "getch()" */
-#endif /* SNAKE || NCURSES */
 #endif /* VMS */
-#endif /* USE_SLANG */
+#endif /* !defined(GetChar) */
+
+#if defined(NCURSES)
+/*
+ * Workaround a bug in ncurses order-of-refresh by setting a pointer to
+ * the topmost window that should be displayed.
+ */
+PRIVATE WINDOW *my_subwindow;
+
+PUBLIC void LYsubwindow ARGS1(WINDOW *, param)
+{
+       my_subwindow = param;
+}
+#endif
 
 /*
  * LYgetch() translates some escape sequences and may fake noecho

-- 
Thomas E. Dickey
address@hidden
http://www.clark.net/pub/dickey
;
; To UNSUBSCRIBE:  Send a mail message to address@hidden
;                  with "unsubscribe lynx-dev" (without the
;                  quotation marks) on a line by itself.
;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]