# ------------------------------------------------------------------------------
# CHANGES          |   17 +++++++++++++++++
# config.hin       |    1 +
# configure        |    2 +-
# configure.in     |    2 +-
# src/LYCurses.c   |    2 +-
# src/LYEdit.c     |    4 ++++
# src/LYMainLoop.c |    2 +-
# src/LYStrings.c  |   32 +++++++++++++++++++++++++++++++-
# src/LYStyle.c    |   14 ++++++++++----
# 9 files changed, 67 insertions(+), 9 deletions(-)
# ------------------------------------------------------------------------------
Index: CHANGES
--- lynx2.8.4rel.1+/CHANGES	Tue Jul 17 17:04:37 2001
+++ lynx2.8.4rel.1a/CHANGES	Mon Jul 23 21:43:12 2001
@@ -1,6 +1,23 @@
 Changes since Lynx 2.8 release
 ===============================================================================
 
+2001-07-24 (2.8.5dev.1)
+* modify GetChar() definition for PDCurses to ignore key-modifiers which are
+  passed back from getch() as if they were key codes.  Those interfere with
+  shifted commands such as 'Q' -TD
+* modify parse_style() function to operate on a copy of its parameter, to avoid
+  changing it.  Otherwise, when parse_style() is executed as a side effect of
+  start_curses(), its data is modified and not valid on successive calls.
+  This bug existed prior to 2.8.4dev.17 -TD
+* set return value of edit_current_file() to true if the file is edited.  This
+  forces a reload for example if one edits the current html file, and is needed
+  to make PDCurses repaint the screen as well (report by vtailor@gte.net,
+  bug introduced in 2.8.4dev.21) -TD
+* add ifdef for wresize() to accommodate FreeBSD 3.x which has resizeterm() but
+  not wresize().  Also, use a 'long' rather than 'attr_t'.  These changes are
+  needed to build with the 1.8.6ache patches to ncurses (report by Matt
+  <matt@greenviolet.net>) -TD
+
 2001-07-17 (2.8.4rel.1)
 * remove comment in README.ssl directing people to
   http://www.moxienet.com/lynx/, since that page is moot with 2.8.4 (report by
Index: config.hin
--- lynx2.8.4rel.1+/config.hin	Sun Jun  3 17:17:35 2001
+++ lynx2.8.4rel.1a/config.hin	Mon Jul 23 20:56:21 2001
@@ -150,6 +150,7 @@
 #undef HAVE_WAITPID
 #undef HAVE_WBORDER
 #undef HAVE_WREDRAWLN
+#undef HAVE_WRESIZE
 #undef HAVE_XCURSES		/* CF_PDCURSES_X11 */
 #undef HAVE___ARGZ_COUNT	/* defined by AM_GNU_GETTEXT */
 #undef HAVE___ARGZ_NEXT		/* defined by AM_GNU_GETTEXT */
Index: configure
--- lynx2.8.4rel.1+/configure	Tue Jul 17 17:04:37 2001
+++ lynx2.8.4rel.1a/configure	Mon Jul 23 20:55:50 2001
@@ -12241,7 +12241,7 @@
 		newpad \
 		newterm \
 		pnoutrefresh \
-		resizeterm \
+		wresize resizeterm \
 		touchline \
 		touchwin \
 		use_default_colors \
Index: configure.in
--- lynx2.8.4rel.1+/configure.in	Tue Jul 17 17:04:37 2001
+++ lynx2.8.4rel.1a/configure.in	Mon Jul 23 20:55:50 2001
@@ -610,7 +610,7 @@
 		newpad \
 		newterm \
 		pnoutrefresh \
-		resizeterm \
+		wresize resizeterm \
 		touchline \
 		touchwin \
 		use_default_colors \
Index: src/LYCurses.c
--- lynx2.8.4rel.1+/src/LYCurses.c	Sat Jul  7 21:41:23 2001
+++ lynx2.8.4rel.1a/src/LYCurses.c	Mon Jul 23 20:55:50 2001
@@ -1538,7 +1538,7 @@
 	LYsubwindow(form_window);
 #  ifdef USE_COLOR_STYLE
 	{
-	    attr_t b;
+	    long b;
 
 	    /* Get a proper value for the attribute */
 	    LynxWChangeStyle(form_window, s_menu_bg, STACK_ON);
Index: src/LYEdit.c
--- lynx2.8.4rel.1+/src/LYEdit.c	Sun Jun  3 17:17:35 2001
+++ lynx2.8.4rel.1a/src/LYEdit.c	Mon Jul 23 19:56:42 2001
@@ -156,6 +156,7 @@
 	sprintf(position, "%d", lineno);
 
     edit_temporary_file(filename, position, NULL);
+    result = TRUE;
 
 done:
     /*
@@ -165,6 +166,7 @@
 	*number_sign = '#';
 
     FREE(filename);
+    CTRACE((tfp, "edit_current_file returns %d\n", result));
     return (result);
 }
 
@@ -173,7 +175,9 @@
 	char *,		position,
 	char *,		message)
 {
+#ifdef UNIX
     struct stat stat_info;
+#endif
     char *format = "%s %s";
     char *command = NULL;
     char *editor_arg = "";
Index: src/LYMainLoop.c
--- lynx2.8.4rel.1+/src/LYMainLoop.c	Sat Jul  7 21:41:23 2001
+++ lynx2.8.4rel.1a/src/LYMainLoop.c	Mon Jul 23 20:55:50 2001
@@ -6143,7 +6143,7 @@
 	     *  WINDOW structures are already filled based on the old size.
 	     *  So we notify the ncurses library directly here. - kw
 	     */
-#if defined(NCURSES) && defined(HAVE_RESIZETERM)
+#if defined(NCURSES) && defined(HAVE_RESIZETERM) && defined(HAVE_WRESIZE)
 	    resizeterm(LYlines, LYcols);
 	    wresize(LYwin, LYlines, LYcols);
 #else
Index: src/LYStrings.c
--- lynx2.8.4rel.1+/src/LYStrings.c	Sun Jun 10 21:14:52 2001
+++ lynx2.8.4rel.1a/src/LYStrings.c	Mon Jul 23 19:32:48 2001
@@ -703,6 +703,36 @@
 #define GetChar() wgetch(my_subwindow ? my_subwindow : LYwin)
 #endif
 
+#if !defined(GetChar) && defined(PDCURSES)
+/* PDCurses sends back key-modifiers that we don't use, but would waste time
+ * upon, e.g., repainting the status line
+ */
+PRIVATE int myGetChar NOARGS
+{
+    int c;
+    BOOL done = FALSE;
+
+    do {
+	switch (c = wgetch(LYwin))
+	{
+	case KEY_SHIFT_L :
+	case KEY_SHIFT_R :
+	case KEY_CONTROL_L :
+	case KEY_CONTROL_R :
+	case KEY_ALT_L :
+	case KEY_ALT_R :
+	case KEY_RESIZE :
+	    break;
+	default:
+	    done = TRUE;
+	    break;
+	}
+    } while (!done);
+    return c;
+}
+#define GetChar() myGetChar()
+#endif
+
 #if !defined(GetChar) && defined(SNAKE)
 #define GetChar() wgetch(LYwin)
 #endif
@@ -713,7 +743,7 @@
 
 #if !defined(GetChar)
 #if HAVE_KEYPAD
-#define GetChar getch
+#define GetChar() getch()
 #else
 #ifndef USE_GETCHAR
 #define USE_GETCHAR
Index: src/LYStyle.c
--- lynx2.8.4rel.1+/src/LYStyle.c	Sat Jul  7 21:41:23 2001
+++ lynx2.8.4rel.1a/src/LYStyle.c	Mon Jul 23 20:24:32 2001
@@ -190,7 +190,7 @@
 	    curPair = our_pairs[!!(cA & A_BOLD)][!!(cA & M_BLINK)][fA][bA] - 1;
 	else {
 	    curPair = ++colorPairs;
-	    init_pair(curPair, fA, bA);
+	    init_pair((short)curPair, (short)fA, (short)bA);
 	    if (fA < MAX_COLOR
 	     && bA < MAX_COLOR
 	     && curPair < 255)
@@ -216,7 +216,7 @@
 /* parse a style option of the format
  * STYLE:<OBJECT>:FG:BG
  */
-PRIVATE void parse_style ARGS1(char*,buffer)
+PRIVATE void parse_style ARGS1(char*, param)
 {
     static struct {
 	char *name;
@@ -254,6 +254,7 @@
     unsigned n;
     BOOL found = FALSE;
 
+    char *buffer = strdup(param);
     char *tmp = strchr(buffer, ':');
     char *element, *mono, *fg, *bg;
 
@@ -339,6 +340,7 @@
 	else
 	    parse_attributes(mono,fg,bg, DSTYLE_ELEMENTS,element);
     }
+    FREE(buffer);
 }
 
 #ifdef LY_FIND_LEAKS
@@ -366,6 +368,7 @@
     };
     unsigned n;
     char temp[80];
+    CTRACE((tfp, "initialize_default_stylesheet\n"));
     for (n = 0; n < TABLESIZE(table); n++) {
 	parse_style(strcpy(temp, table[n]));
     }
@@ -410,10 +413,11 @@
  * need to remember the STYLE: lines we encounter and parse them
  * after curses has started
  */
-HTList *lss_styles = NULL;
+PRIVATE HTList *lss_styles = NULL;
 
 PUBLIC void parse_userstyles NOARGS
 {
+    static BOOL first = TRUE;
     char *name;
     HTList *cur = lss_styles;
 
@@ -453,9 +457,11 @@
 /* Add a STYLE: option line to our list.  Process "default:" early
    for it to have the same semantic as other lines: works at any place
    of the style file, the first line overrides the later ones. */
-PRIVATE void HStyle_addStyle ARGS1(char*,buffer)
+PRIVATE void HStyle_addStyle ARGS1(char*, buffer)
 {
     char *name = NULL;
+
+    CTRACE((tfp, "HStyle_addStyle(%s)\n", buffer));
     StrAllocCopy(name, buffer);
     if (lss_styles == NULL)
 	lss_styles = HTList_new();