diff options
author | 2017-05-12 14:37:52 +0000 | |
---|---|---|
committer | 2017-05-12 14:37:52 +0000 | |
commit | 3e1731416f23149ce46f0bb247a181999b61d190 (patch) | |
tree | c0f86319809bd30a7b55bf0ff1444cead1eb5353 /bin/ksh/emacs.c | |
parent | Instead of printing a debug message at the end of processing, panic (diff) | |
download | wireguard-openbsd-3e1731416f23149ce46f0bb247a181999b61d190.tar.xz wireguard-openbsd-3e1731416f23149ce46f0bb247a181999b61d190.zip |
Improve UTF-8 handling on lines that are wider than the terminal,
in two respects:
1. During output in x_e_putc(), when counting display columns,
skip UTF-8 continuation bytes. Fixes backward movements that
cause horizontal scrolling.
2. After deleting characters, recalculate the last byte that fits
on the line.
Patch from <Anton dot Lindqvist at gmail dot com> on tech@.
OK millert@ tb@
Diffstat (limited to 'bin/ksh/emacs.c')
-rw-r--r-- | bin/ksh/emacs.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/bin/ksh/emacs.c b/bin/ksh/emacs.c index 2f82b5beafe..3c728ad8f68 100644 --- a/bin/ksh/emacs.c +++ b/bin/ksh/emacs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: emacs.c,v 1.66 2016/08/09 11:04:46 schwarze Exp $ */ +/* $OpenBSD: emacs.c,v 1.67 2017/05/12 14:37:52 schwarze Exp $ */ /* * Emacs-like command line editing and history @@ -533,6 +533,7 @@ x_delete(int nc, int push) } memmove(xcp, xcp+nc, xep - xcp + 1); /* Copies the null */ x_adj_ok = 0; /* don't redraw */ + xlp_valid = false; x_zots(xcp); /* * if we are already filling the line, @@ -1909,7 +1910,8 @@ x_e_putc(int c) x_col--; break; default: - x_col++; + if (!isu8cont(c)) + x_col++; break; } } |