aboutsummaryrefslogtreecommitdiff
path: root/sdn.cpp
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2020-10-21 23:33:32 +0200
committerPřemysl Eric Janouch <p@janouch.name>2020-10-21 23:56:51 +0200
commit5d0c105b104654093a479fd4c4027589023c4d4a (patch)
tree5b40f41b9389a75958a15ad8409db58140da2e5b /sdn.cpp
parent33a8e26efcdd23503a95ca53f8490a53ec42da54 (diff)
downloadsdn-5d0c105b104654093a479fd4c4027589023c4d4a.tar.gz
sdn-5d0c105b104654093a479fd4c4027589023c4d4a.tar.xz
sdn-5d0c105b104654093a479fd4c4027589023c4d4a.zip
Make backspace erase combining characters
They might not be even printed correctly, though. Updates #4
Diffstat (limited to 'sdn.cpp')
-rw-r--r--sdn.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/sdn.cpp b/sdn.cpp
index 74b70cf..fb65d7d 100644
--- a/sdn.cpp
+++ b/sdn.cpp
@@ -1186,8 +1186,13 @@ fun handle_editor (wint_t c) {
g.editor_on_confirm = nullptr;
break;
case ACTION_INPUT_B_DELETE:
- if (g.editor_cursor > 0)
- g.editor_line.erase (--g.editor_cursor, 1);
+ // Remove the last character including its postfix combining characters
+ while (g.editor_cursor > 0) {
+ auto erased = g.editor_line.at (--g.editor_cursor);
+ g.editor_line.erase (g.editor_cursor, 1);
+ if (wcwidth (erased))
+ break;
+ }
break;
default:
if (c & (ALT | SYM)) {