diff options
author | Jan Arne Petersen <jpetersen@openismus.com> | 2013-05-30 13:57:02 +0200 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2013-06-04 00:34:46 -0400 |
commit | a96953dffa79f91b81e57124ca98f332b3050cde (patch) | |
tree | 1be2fc4d5dcdacb0b819a50f8a2798e6e17f9863 /clients | |
parent | 1c45b4a4a992d3ca93b59fc7660856ef721cf06c (diff) |
editor: Support deleting text in preedit_string
Delete text marked with wl_text_input::delete_surrounding_text on
preedit_string event. When text is explicitly marked with
delete_surrounding_text do not delete selected text.
Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
Diffstat (limited to 'clients')
-rw-r--r-- | clients/editor.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/clients/editor.c b/clients/editor.c index 03cdc125..16ede4ff 100644 --- a/clients/editor.c +++ b/clients/editor.c @@ -146,12 +146,13 @@ text_input_commit_string(void *data, text_entry_reset_preedit(entry); - text_entry_delete_selected_text(entry); if (entry->pending_commit.delete_length) { text_entry_delete_text(entry, entry->pending_commit.delete_index, entry->pending_commit.delete_length); + } else { + text_entry_delete_selected_text(entry); } text_entry_insert_at_cursor(entry, text, @@ -172,7 +173,15 @@ text_input_preedit_string(void *data, { struct text_entry *entry = data; - text_entry_delete_selected_text(entry); + if (entry->pending_commit.delete_length) { + text_entry_delete_text(entry, + entry->pending_commit.delete_index, + entry->pending_commit.delete_length); + } else { + text_entry_delete_selected_text(entry); + } + memset(&entry->pending_commit, 0, sizeof entry->pending_commit); + text_entry_set_preedit(entry, text, entry->preedit_info.cursor); entry->preedit.commit = strdup(commit); entry->preedit.attr_list = entry->preedit_info.attr_list; |