mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-17 23:50:16 +00:00
text: Optimize away 0-change insertions and deletions
We can short-circuit insert and delete calls that are not causing any change.
This commit is contained in:
parent
447203ce52
commit
ccae0e1732
@ -3309,6 +3309,9 @@ gtk_text_insert_text (GtkText *self,
|
||||
int n_inserted;
|
||||
int n_chars;
|
||||
|
||||
if (length == 0)
|
||||
return;
|
||||
|
||||
n_chars = g_utf8_strlen (text, length);
|
||||
|
||||
/*
|
||||
@ -3338,6 +3341,9 @@ gtk_text_delete_text (GtkText *self,
|
||||
{
|
||||
GtkTextPrivate *priv = gtk_text_get_instance_private (self);
|
||||
|
||||
if (start_pos == end_pos)
|
||||
return;
|
||||
|
||||
begin_change (self);
|
||||
|
||||
gtk_entry_buffer_delete_text (get_buffer (self), start_pos, end_pos - start_pos);
|
||||
|
Loading…
Reference in New Issue
Block a user