Short-circuit the text to the exact same thing, so we don't unexpectedly

Wed Mar 20 19:00:03 2002  Owen Taylor  <otaylor@redhat.com>

        * gtk/gtkentry.c (gtk_entry_set_text): Short-circuit
        the text to the exact same thing, so we don't
        unexpectedly change the selection or cursor position.
        (#74290, John Ellis.)
This commit is contained in:
Owen Taylor 2002-03-21 00:08:19 +00:00 committed by Owen Taylor
parent dc5be9edc5
commit 22b1b079ef
7 changed files with 50 additions and 2 deletions

View File

@ -1,3 +1,10 @@
Wed Mar 20 19:00:03 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_set_text): Short-circuit
the text to the exact same thing, so we don't
unexpectedly change the selection or cursor position.
(#74290, John Ellis.)
Thu Mar 21 00:05:14 2002 Kristian Rietveld <kris@gtk.org> Thu Mar 21 00:05:14 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreeview.c (gtk_tree_view_get_background_area), * gtk/gtktreeview.c (gtk_tree_view_get_background_area),

View File

@ -1,3 +1,10 @@
Wed Mar 20 19:00:03 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_set_text): Short-circuit
the text to the exact same thing, so we don't
unexpectedly change the selection or cursor position.
(#74290, John Ellis.)
Thu Mar 21 00:05:14 2002 Kristian Rietveld <kris@gtk.org> Thu Mar 21 00:05:14 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreeview.c (gtk_tree_view_get_background_area), * gtk/gtktreeview.c (gtk_tree_view_get_background_area),

View File

@ -1,3 +1,10 @@
Wed Mar 20 19:00:03 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_set_text): Short-circuit
the text to the exact same thing, so we don't
unexpectedly change the selection or cursor position.
(#74290, John Ellis.)
Thu Mar 21 00:05:14 2002 Kristian Rietveld <kris@gtk.org> Thu Mar 21 00:05:14 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreeview.c (gtk_tree_view_get_background_area), * gtk/gtktreeview.c (gtk_tree_view_get_background_area),

View File

@ -1,3 +1,10 @@
Wed Mar 20 19:00:03 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_set_text): Short-circuit
the text to the exact same thing, so we don't
unexpectedly change the selection or cursor position.
(#74290, John Ellis.)
Thu Mar 21 00:05:14 2002 Kristian Rietveld <kris@gtk.org> Thu Mar 21 00:05:14 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreeview.c (gtk_tree_view_get_background_area), * gtk/gtktreeview.c (gtk_tree_view_get_background_area),

View File

@ -1,3 +1,10 @@
Wed Mar 20 19:00:03 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_set_text): Short-circuit
the text to the exact same thing, so we don't
unexpectedly change the selection or cursor position.
(#74290, John Ellis.)
Thu Mar 21 00:05:14 2002 Kristian Rietveld <kris@gtk.org> Thu Mar 21 00:05:14 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreeview.c (gtk_tree_view_get_background_area), * gtk/gtktreeview.c (gtk_tree_view_get_background_area),

View File

@ -1,3 +1,10 @@
Wed Mar 20 19:00:03 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_set_text): Short-circuit
the text to the exact same thing, so we don't
unexpectedly change the selection or cursor position.
(#74290, John Ellis.)
Thu Mar 21 00:05:14 2002 Kristian Rietveld <kris@gtk.org> Thu Mar 21 00:05:14 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreeview.c (gtk_tree_view_get_background_area), * gtk/gtktreeview.c (gtk_tree_view_get_background_area),

View File

@ -3266,14 +3266,20 @@ gtk_entry_new_with_max_length (gint max)
} }
void void
gtk_entry_set_text (GtkEntry *entry, gtk_entry_set_text (GtkEntry *entry,
const gchar *text) const gchar *text)
{ {
gint tmp_pos; gint tmp_pos;
g_return_if_fail (GTK_IS_ENTRY (entry)); g_return_if_fail (GTK_IS_ENTRY (entry));
g_return_if_fail (text != NULL); g_return_if_fail (text != NULL);
/* Actually setting the text will affect the cursor and selection;
* if the contents don't actually change, this will look odd to the user.
*/
if (strcmp (entry->text, text) == 0)
return;
gtk_editable_delete_text (GTK_EDITABLE (entry), 0, -1); gtk_editable_delete_text (GTK_EDITABLE (entry), 0, -1);
tmp_pos = 0; tmp_pos = 0;