diff options
author | 2002-08-29 22:45:22 +0000 | |
---|---|---|
committer | 2002-08-29 22:45:22 +0000 | |
commit | d83c790c862c0d74999e2e51ee33ff64b1144a83 (patch) | |
tree | 3535af18262087274ab209ad1bf18e3a5a93936d | |
parent | Produce the same escape codes as SunOS with the L function keys in console. (diff) | |
download | wireguard-openbsd-d83c790c862c0d74999e2e51ee33ff64b1144a83.tar.xz wireguard-openbsd-d83c790c862c0d74999e2e51ee33ff64b1144a83.zip |
fix a little display bug when editing a file with binary characters, columns
weren't calculated correctly.
ok deraadt@
-rw-r--r-- | usr.bin/mg/display.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/usr.bin/mg/display.c b/usr.bin/mg/display.c index bbcd940d44b..f2a8acdc010 100644 --- a/usr.bin/mg/display.c +++ b/usr.bin/mg/display.c @@ -1,4 +1,4 @@ -/* $OpenBSD: display.c,v 1.17 2002/08/22 23:28:19 deraadt Exp $ */ +/* $OpenBSD: display.c,v 1.18 2002/08/29 22:45:22 vincent Exp $ */ /* * The functions in this file handle redisplay. The @@ -486,11 +486,19 @@ update(void) #ifdef NOTAB && !(curbp->b_flag & BFNOTAB) #endif - ) + ) { curcol |= 0x07; - else if (ISCTRL(c) != FALSE) - ++curcol; - ++curcol; + curcol++; + } else if (ISCTRL(c) != FALSE) + curcol += 2; + else if (isprint(c)) + curcol++; + else { + char bf[5]; + + snprintf(bf, sizeof bf, "\\%o", c); + curcol += strlen(bf); + } } if (curcol >= ncol - 1) { /* extended line. */ /* flag we are extended and changed */ |