editor: Properly adjust cursor on delete
Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
This commit is contained in:
committed by
Kristian Høgsberg
parent
a96953dffa
commit
9eaa8e51ca
+7
-4
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user