about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2007-11-12 12:16:50 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2007-11-12 12:16:50 +0000
commit1ff856951ba649b21fb6c8d9dbe5e12a5b736a33 (patch)
tree612c24466dfba233c98cdbd6e9ee0383ea81eddd /Src
parentbd6f46103aacc67c3fffa9c096070a05fa3f0812 (diff)
downloadzsh-1ff856951ba649b21fb6c8d9dbe5e12a5b736a33.tar.gz
zsh-1ff856951ba649b21fb6c8d9dbe5e12a5b736a33.tar.xz
zsh-1ff856951ba649b21fb6c8d9dbe5e12a5b736a33.zip
24089 plus tweak: fix curses on older systems
Diffstat (limited to 'Src')
-rw-r--r--Src/Modules/curses.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/Src/Modules/curses.c b/Src/Modules/curses.c
index 37d5b5283..19f58cc62 100644
--- a/Src/Modules/curses.c
+++ b/Src/Modules/curses.c
@@ -94,7 +94,13 @@ static struct ttyinfo saved_tty_state;
 static struct ttyinfo curses_tty_state;
 static LinkList zcurses_windows;
 static HashTable zcurses_colorpairs = NULL;
+#ifdef NCURSES_MOUSE_VERSION
+/*
+ * The following is in principle a general set of flags, but
+ * is currently only needed for mouse status.
+ */
 static int zcurses_flags;
+#endif
 
 #define ZCURSES_EINVALID 1
 #define ZCURSES_EDEFINED 2
@@ -394,6 +400,9 @@ zcurses_colornode(HashNode hn, int cp)
 static Colorpairnode
 zcurses_colorget_reverse(short cp)
 {
+    if (!zcurses_colorpairs)
+	return NULL;
+
     cpn_match = NULL;
     scanhashtable(zcurses_colorpairs, 0, 0, 0,
 		  zcurses_colornode, cp);
@@ -1331,14 +1340,14 @@ zccmd_querychar(const char *nam, char **args)
     Colorpairnode cpn;
     const struct zcurses_namenumberpair *zattrp;
     LinkList clist;
-    attr_t attrs;
 #if defined(HAVE_WIN_WCH) && defined(HAVE_GETCCHAR)
+    attr_t attrs;
     wchar_t c;
     cchar_t cc;
     int count;
     VARARR(char, instr, 2*MB_CUR_MAX+1);
 #else
-    chtype inc;
+    chtype inc, attrs;
     char instr[3];
 #endif
 
@@ -1376,11 +1385,7 @@ zccmd_querychar(const char *nam, char **args)
 	instr[0] = STOUC(inc);
 	instr[1] = '\0';
     }
-    /*
-     * I'm guessing this is OK... header says attr_t must be at
-     * least as wide as chtype.
-     */
-    attrs = (attr_t)inc;
+    attrs = inc;
 #endif
 
     /*