Inlined diff helps ksh search-history function (ctrl-r) to handle
backspace for UTF8 characters properly, without the patch, if I have
UTF8 characters in my search buffer, I need to press backspace twice to
push cursor to the left.
The search itself is not perfect for UTF8 either, sometimes I get
patterns which are not handled properly, or the input prompt becomes
mangled, but the issue with backspace is what currently bothers me the
most.
Comments, objections?
diff --git bin/ksh/emacs.c bin/ksh/emacs.c
index 5370e814f70..0058bad9adb 100644
--- bin/ksh/emacs.c
+++ bin/ksh/emacs.c
@@ -908,7 +908,9 @@ x_search_hist(int c)
break;
}
if (p > pat)
- *--p = '\0';
+ while (isu8cont(*--p))
+ ;
+ *p ='\0';
if (p == pat)
offset = -1;
else