summaryrefslogtreecommitdiffstats
path: root/contrib/nvi/ex
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2013-11-11 16:52:02 +0000
committerpeter <peter@FreeBSD.org>2013-11-11 16:52:02 +0000
commitaa72ff78d359a6d72be67471e975b6510987fe0b (patch)
tree0930288f13fda7a3b61b3f30402152bd8564197f /contrib/nvi/ex
parent587aa2d7ea7a421590ac304146d66f82144ca8b2 (diff)
downloadFreeBSD-src-aa72ff78d359a6d72be67471e975b6510987fe0b.zip
FreeBSD-src-aa72ff78d359a6d72be67471e975b6510987fe0b.tar.gz
Merge nvi-2.1.1 -> 2.1.2
Diffstat (limited to 'contrib/nvi/ex')
-rw-r--r--contrib/nvi/ex/ex_print.c43
-rw-r--r--contrib/nvi/ex/version.h2
2 files changed, 28 insertions, 17 deletions
diff --git a/contrib/nvi/ex/ex_print.c b/contrib/nvi/ex/ex_print.c
index 2c9208a..5903e97 100644
--- a/contrib/nvi/ex/ex_print.c
+++ b/contrib/nvi/ex/ex_print.c
@@ -10,7 +10,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "$Id: ex_print.c,v 10.25 2011/12/12 22:12:20 zy Exp $";
+static const char sccsid[] = "$Id: ex_print.c,v 10.26 2013/11/02 02:11:07 zy Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -213,7 +213,7 @@ ex_prchars(SCR *sp, const CHAR_T *p, size_t *colp, size_t len,
gp = sp->gp;
ts = O_VAL(sp, O_TABSTOP);
for (col = *colp; len--;)
- if ((ch = *p++) == '\t' && !LF_ISSET(E_C_LIST))
+ if ((ch = *p++) == L('\t') && !LF_ISSET(E_C_LIST))
for (tlen = ts - col % ts;
col < sp->cols && tlen--; ++col) {
(void)ex_printf(sp,
@@ -223,21 +223,32 @@ ex_prchars(SCR *sp, const CHAR_T *p, size_t *colp, size_t len,
}
else {
kp = KEY_NAME(sp, ch);
- tlen = KEY_LEN(sp, ch);
- if (!repeatc && col + tlen < sp->cols) {
+ tlen = KEY_COL(sp, ch);
+
+ /*
+ * Start a new line if the last character does not fit
+ * into the current line. The implicit new lines are
+ * not interruptible.
+ */
+ if (col + tlen > sp->cols) {
+ col = 0;
+ (void)ex_puts(sp, "\n");
+ }
+
+ col += tlen;
+ if (!repeatc) {
(void)ex_puts(sp, kp);
- col += tlen;
- } else
- for (; tlen--; ++kp, ++col) {
- if (col == sp->cols) {
- col = 0;
- (void)ex_puts(sp, "\n");
- }
- (void)ex_printf(sp,
- "%c", repeatc ? repeatc : *kp);
- if (INTERRUPTED(sp))
- goto intr;
- }
+ if (INTERRUPTED(sp))
+ goto intr;
+ } else while (tlen--) {
+ (void)ex_printf(sp, "%c", repeatc);
+ if (INTERRUPTED(sp))
+ goto intr;
+ }
+ if (col == sp->cols) {
+ col = 0;
+ (void)ex_puts(sp, "\n");
+ }
}
intr: *colp = col;
return (0);
diff --git a/contrib/nvi/ex/version.h b/contrib/nvi/ex/version.h
index 295dd8e..ef0af0f 100644
--- a/contrib/nvi/ex/version.h
+++ b/contrib/nvi/ex/version.h
@@ -1 +1 @@
-#define VI_VERSION "2.1.1 (2012-10-07)"
+#define VI_VERSION "2.1.2 (2012-11-02)"
OpenPOWER on IntegriCloud