From 80306c57799a4ba6382d6af7b4a67a01fdefd437 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Janouch?= Date: Tue, 27 Jun 2017 20:03:38 +0200 Subject: [PATCH] Skip combining marks in the editor For slightly more correct Unicode handling. --- src/sdtui.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/sdtui.c b/src/sdtui.c index 406a780..944d168 100644 --- a/src/sdtui.c +++ b/src/sdtui.c @@ -1486,14 +1486,18 @@ app_process_user_action (Application *self, UserAction action) case USER_ACTION_INPUT_LEFT: if (self->input_pos > 0) { - self->input_pos--; + do self->input_pos--; + while (self->input_pos > 0 && g_unichar_ismark + (g_array_index (self->input, gunichar, self->input_pos))); app_redraw_top (self); } return TRUE; case USER_ACTION_INPUT_RIGHT: if (self->input_pos < self->input->len) { - self->input_pos++; + do self->input_pos++; + while (self->input_pos < self->input->len && g_unichar_ismark + (g_array_index (self->input, gunichar, self->input_pos))); app_redraw_top (self); } return TRUE;