summaryrefslogtreecommitdiff
path: root/bin/ksh
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2017-05-12 14:37:53 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2017-05-12 14:37:53 +0000
commit2cb31b10679106958d5f40c89aa2ace2e2bc5005 (patch)
tree1ac5820c8ae43ad9fb1f5b7b3f7aa67ee5e31316 /bin/ksh
parent6538725ae0b7af2fc683108f98a78cf390e2e281 (diff)
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')
-rw-r--r--bin/ksh/emacs.c6
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;
}
}