summaryrefslogtreecommitdiffstats
path: root/contrib/nvi/ex
diff options
context:
space:
mode:
authorgjb <gjb@FreeBSD.org>2013-11-16 19:22:13 +0000
committergjb <gjb@FreeBSD.org>2013-11-16 19:22:13 +0000
commitcc8b081ade8565ef580347db1674be2ba765ce17 (patch)
tree7cfab9a8ed980bb5f467fb7747bb3174574e0209 /contrib/nvi/ex
parent8eaba2804804dd2ab64fe5068337bbbbc922b838 (diff)
downloadFreeBSD-src-cc8b081ade8565ef580347db1674be2ba765ce17.zip
FreeBSD-src-cc8b081ade8565ef580347db1674be2ba765ce17.tar.gz
MFC r257999 (peter):
Merge nvi-2.1.1 -> 2.1.2 Approved by: re (???) Sponsored by: The FreeBSD Foundation
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