From: Jan Arne Petersen <jpeter...@openismus.com>

Signed-off-by: Jan Arne Petersen <jpeter...@openismus.com>
---
 clients/editor.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/clients/editor.c b/clients/editor.c
index 16ede4f..35f6d08 100644
--- a/clients/editor.c
+++ b/clients/editor.c
@@ -837,16 +837,19 @@ text_entry_delete_text(struct text_entry *entry,
 {
        uint32_t l;
 
-       if (entry->cursor > index)
-               entry->cursor -= length;
-
-       entry->anchor = entry->cursor;
 
        l = strlen(entry->text + index + length);
        memmove(entry->text + index,
                entry->text + index + length,
                l + 1);
 
+       if (entry->cursor > (index + length))
+               entry->cursor -= length;
+       else if (entry->cursor > index)
+               entry->cursor = index;
+
+       entry->anchor = entry->cursor;
+
        text_entry_update_layout(entry);
 
        widget_schedule_redraw(entry->widget);
-- 
1.8.1.4

_______________________________________________
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to