From 87e0582f0344e35c30bf9480a2fc3cabe8b22b5d Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 25 Jun 2011 18:49:54 -0400 Subject: [PATCH] Fix up signal ordering issues in GtkEntry Ensure that text and selection boundaries are in a consistent state when we emit notifications, that ::insert-text and ::delete-text are emitted before any changes, and that ::changed is emitted after property notifications when inserting or deleting text. Conflicts: gtk/gtkentry.c --- gtk/gtkentry.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index 1d9867321b..1921093265 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -4581,12 +4581,18 @@ buffer_inserted_text (GtkEntryBuffer *buffer, GtkEntry *entry) { guint password_hint_timeout; + guint current_pos; + gint selection_bound; - if (entry->current_pos > position) - entry->current_pos += n_chars; + current_pos = entry->current_pos; + if (current_pos > position) + current_pos += n_chars; - if (entry->selection_bound > position) - entry->selection_bound += n_chars; + selection_bound = entry->selection_bound; + if (selection_bound > position) + selection_bound += n_chars; + + gtk_entry_set_positions (entry, current_pos, selection_bound); /* Calculate the password hint if it needs to be displayed. */ if (n_chars == 1 && !entry->visible)