aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Wemm <peter@FreeBSD.org>2013-12-08 00:04:25 +0000
committerPeter Wemm <peter@FreeBSD.org>2013-12-08 00:04:25 +0000
commit1abe484249caf1c5e462ce3110c8db09c059c6e8 (patch)
tree75943e720084af9a019fb2ca8fb605765cbf398d
parent44e7e21f380c105a8a76abcbb43224be8379e340 (diff)
downloadsrc-1abe484249caf1c5e462ce3110c8db09c059c6e8.tar.gz
src-1abe484249caf1c5e462ce3110c8db09c059c6e8.zip
Import nvi2 as of c80f493, including:vendor/nvi/2.1.2-c80f493b0382d3c
Fix cleanup multikey mappgs (FreeBSD bin/182463)
Notes
Notes: svn path=/vendor/nvi/dist/; revision=259086 svn path=/vendor/nvi/2.1.2-c80f493b0382d3c/; revision=259087; tag=vendor/nvi/2.1.2-c80f493b0382d3c
-rw-r--r--cl/cl_term.c12
-rw-r--r--common/key.c4
-rw-r--r--common/key.h10
3 files changed, 16 insertions, 10 deletions
diff --git a/cl/cl_term.c b/cl/cl_term.c
index 3d8cdb2e2b52..7e8f6c7735a2 100644
--- a/cl/cl_term.c
+++ b/cl/cl_term.c
@@ -10,7 +10,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "$Id: cl_term.c,v 10.33 2012/04/21 23:51:46 zy Exp $";
+static const char sccsid[] = "$Id: cl_term.c,v 10.34 2013/12/07 16:21:14 wjenkner Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -187,14 +187,18 @@ cl_term_init(SCR *sp)
int
cl_term_end(GS *gp)
{
- SEQ *qp, *nqp;
+ SEQ *qp, *nqp, *pre_qp = NULL;
/* Delete screen specific mappings. */
SLIST_FOREACH_SAFE(qp, gp->seqq, q, nqp)
if (F_ISSET(qp, SEQ_SCREEN)) {
- SLIST_REMOVE_HEAD(gp->seqq, q);
+ if (qp == SLIST_FIRST(gp->seqq))
+ SLIST_REMOVE_HEAD(gp->seqq, q);
+ else
+ SLIST_REMOVE_AFTER(pre_qp, q);
(void)seq_free(qp);
- }
+ } else
+ pre_qp = qp;
return (0);
}
diff --git a/common/key.c b/common/key.c
index 652b8f3eae00..9fc20b73d940 100644
--- a/common/key.c
+++ b/common/key.c
@@ -10,7 +10,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "$Id: key.c,v 10.53 2013/03/11 01:20:53 yamt Exp $";
+static const char sccsid[] = "$Id: key.c,v 10.54 2013/11/13 12:15:27 zy Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -272,7 +272,7 @@ v_key_name(
* The code prints non-printable wide characters in 4 or 5 digits
* Unicode escape sequences, so only supports plane 0 to 15.
*/
- if (ISPRINT(ach))
+ if (CAN_PRINT(sp, ach))
goto done;
nopr: if (iscntrl(ch) && (ch < 0x20 || ch == 0x7f)) {
sp->cname[0] = '^';
diff --git a/common/key.h b/common/key.h
index 3eeca124a00a..43cef77a4af5 100644
--- a/common/key.h
+++ b/common/key.h
@@ -6,7 +6,7 @@
*
* See the LICENSE file for redistribution information.
*
- * $Id: key.h,v 10.55 2012/10/07 01:31:17 zy Exp $
+ * $Id: key.h,v 10.56 2013/11/13 12:15:27 zy Exp $
*/
#include "multibyte.h"
@@ -23,8 +23,9 @@
#define INPUT2INT5(sp,cw,n,nlen,w,wlen) \
sp->conv.input2int(sp, n, nlen, &(cw), &wlen, &w)
#define CONST
+#define INTISWIDE(c) (wctob(c) == EOF)
#define CHAR_WIDTH(sp, ch) wcwidth(ch)
-#define INTISWIDE(c) (wctob(c) == EOF)
+#define CAN_PRINT(sp, ch) (CHAR_WIDTH(sp, ch) > 0)
#else
#define FILE2INT5(sp,buf,n,nlen,w,wlen) \
(w = n, wlen = nlen, 0)
@@ -36,9 +37,10 @@
(n = w, nlen = wlen, 0)
#define INPUT2INT5(sp,buf,n,nlen,w,wlen) \
(w = n, wlen = nlen, 0)
-#define CONST const
-#define INTISWIDE(c) 0
+#define CONST const
+#define INTISWIDE(c) 0
#define CHAR_WIDTH(sp, ch) 1
+#define CAN_PRINT(sp, ch) isprint(ch)
#endif
#define FILE2INT(sp,n,nlen,w,wlen) \
FILE2INT5(sp,sp->cw,n,nlen,w,wlen)