From ad955c8196da560c6a0b10e6abbc8ce8468deb5d Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Fri, 22 Oct 2004 17:30:43 +0000 Subject: [PATCH] ri Oct 22 13:25:25 2004 Owen Taylor * gtk/gtktextbuffer.c (gtk_text_buffer_backspace): Fix backspacing on the empty last line of a buffer (https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=136840, Dan Williams) --- ChangeLog | 7 +++++++ ChangeLog.pre-2-10 | 7 +++++++ ChangeLog.pre-2-6 | 7 +++++++ ChangeLog.pre-2-8 | 7 +++++++ gtk/gtktextbuffer.c | 13 +++++++++++-- 5 files changed, 39 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index a8bbe98bb..3fee684f4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Fri Oct 22 13:25:25 2004 Owen Taylor + + * gtk/gtktextbuffer.c (gtk_text_buffer_backspace): Fix + backspacing on the empty last line of a buffer + (https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=136840, + Dan Williams) + 2004-10-22 Matthias Clasen * gtk/gtkdnd.c: Document how to use info with text/image diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index a8bbe98bb..3fee684f4 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,10 @@ +Fri Oct 22 13:25:25 2004 Owen Taylor + + * gtk/gtktextbuffer.c (gtk_text_buffer_backspace): Fix + backspacing on the empty last line of a buffer + (https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=136840, + Dan Williams) + 2004-10-22 Matthias Clasen * gtk/gtkdnd.c: Document how to use info with text/image diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index a8bbe98bb..3fee684f4 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,10 @@ +Fri Oct 22 13:25:25 2004 Owen Taylor + + * gtk/gtktextbuffer.c (gtk_text_buffer_backspace): Fix + backspacing on the empty last line of a buffer + (https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=136840, + Dan Williams) + 2004-10-22 Matthias Clasen * gtk/gtkdnd.c: Document how to use info with text/image diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index a8bbe98bb..3fee684f4 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,10 @@ +Fri Oct 22 13:25:25 2004 Owen Taylor + + * gtk/gtktextbuffer.c (gtk_text_buffer_backspace): Fix + backspacing on the empty last line of a buffer + (https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=136840, + Dan Williams) + 2004-10-22 Matthias Clasen * gtk/gtkdnd.c: Document how to use info with text/image diff --git a/gtk/gtktextbuffer.c b/gtk/gtktextbuffer.c index 814cf8057..8d822ad35 100644 --- a/gtk/gtktextbuffer.c +++ b/gtk/gtktextbuffer.c @@ -3423,8 +3423,17 @@ gtk_text_buffer_backspace (GtkTextBuffer *buffer, end = *iter; attrs = _gtk_text_buffer_get_line_log_attrs (buffer, &start, NULL); - offset = gtk_text_iter_get_line_offset (&start); - backspace_deletes_character = attrs[offset].backspace_deletes_character; + + /* For no good reason, attrs is NULL for the empty last line in + * a buffer. Special case that here. (#156164) + */ + if (attrs) + { + offset = gtk_text_iter_get_line_offset (&start); + backspace_deletes_character = attrs[offset].backspace_deletes_character; + } + else + backspace_deletes_character = FALSE; gtk_text_iter_backward_cursor_position (&start); -- 2.43.2