[gtk+] entry: Fix a corner case of overwrite mode
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] entry: Fix a corner case of overwrite mode
- Date: Wed, 5 Oct 2016 16:22:33 +0000 (UTC)
commit ddd1ac093436e4c0d5a10b00d30a0f0d39d50bf1
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Oct 5 12:20:14 2016 -0400
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
gtk/gtkentry.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index 79588a1..312277a 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -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,7 +6031,11 @@ gtk_entry_enter_text (GtkEntry *entry,
else
{
if (priv->overwrite_mode)
- gtk_entry_delete_from_cursor (entry, GTK_DELETE_CHARS, 1);
+ {
+ 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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]