entry: Fix a corner case of overwrite mode

We currently beep when a character is appended at the end in
overwrite mode. That is obviously not right. Patch based on
a patch by Ian MacDonald.

https://bugzilla.gnome.org/show_bug.cgi?id=772389
This commit is contained in:
Matthias Clasen 2016-10-05 12:20:14 -04:00
parent 3da324fbce
commit ddd1ac0934

View File

@ -6021,6 +6021,7 @@ gtk_entry_enter_text (GtkEntry *entry,
GtkEditable *editable = GTK_EDITABLE (entry);
gint tmp_pos;
gboolean old_need_im_reset;
guint text_length;
old_need_im_reset = priv->need_im_reset;
priv->need_im_reset = FALSE;
@ -6030,8 +6031,12 @@ gtk_entry_enter_text (GtkEntry *entry,
else
{
if (priv->overwrite_mode)
{
text_length = gtk_entry_buffer_get_length (get_buffer (entry));
if (priv->current_pos < text_length)
gtk_entry_delete_from_cursor (entry, GTK_DELETE_CHARS, 1);
}
}
tmp_pos = priv->current_pos;
gtk_editable_insert_text (editable, str, strlen (str), &tmp_pos);