diff --git a/ChangeLog b/ChangeLog index a606a0ef8d..fba1c60449 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +Tue Nov 30 16:25:29 2004 Owen Taylor + + * gtk/gtktextdisplay.c (render_para): Don't paint in the + trailing end of a wrapped line when the selection + starts after the line. (#159984, Matthias Clasen) + + * gtk/gtktextdisplay.c (gtk_text_layout_draw): pass in byte_count + 1 + for selection_end index when the selection end is past the end of the + line so that render_para() can distinguish it from selection-end + *at* the end of the line. Fixes newlines not being selected. + 2004-11-30 James M. Cape * gtk/gtkfilechooserbutton.h (gtk_file_chooser_button_get_active) diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index a606a0ef8d..fba1c60449 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,14 @@ +Tue Nov 30 16:25:29 2004 Owen Taylor + + * gtk/gtktextdisplay.c (render_para): Don't paint in the + trailing end of a wrapped line when the selection + starts after the line. (#159984, Matthias Clasen) + + * gtk/gtktextdisplay.c (gtk_text_layout_draw): pass in byte_count + 1 + for selection_end index when the selection end is past the end of the + line so that render_para() can distinguish it from selection-end + *at* the end of the line. Fixes newlines not being selected. + 2004-11-30 James M. Cape * gtk/gtkfilechooserbutton.h (gtk_file_chooser_button_get_active) diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index a606a0ef8d..fba1c60449 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,14 @@ +Tue Nov 30 16:25:29 2004 Owen Taylor + + * gtk/gtktextdisplay.c (render_para): Don't paint in the + trailing end of a wrapped line when the selection + starts after the line. (#159984, Matthias Clasen) + + * gtk/gtktextdisplay.c (gtk_text_layout_draw): pass in byte_count + 1 + for selection_end index when the selection end is past the end of the + line so that render_para() can distinguish it from selection-end + *at* the end of the line. Fixes newlines not being selected. + 2004-11-30 James M. Cape * gtk/gtkfilechooserbutton.h (gtk_file_chooser_button_get_active) diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index a606a0ef8d..fba1c60449 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,14 @@ +Tue Nov 30 16:25:29 2004 Owen Taylor + + * gtk/gtktextdisplay.c (render_para): Don't paint in the + trailing end of a wrapped line when the selection + starts after the line. (#159984, Matthias Clasen) + + * gtk/gtktextdisplay.c (gtk_text_layout_draw): pass in byte_count + 1 + for selection_end index when the selection end is past the end of the + line so that render_para() can distinguish it from selection-end + *at* the end of the line. Fixes newlines not being selected. + 2004-11-30 James M. Cape * gtk/gtkfilechooserbutton.h (gtk_file_chooser_button_get_active) diff --git a/gtk/gtktextdisplay.c b/gtk/gtktextdisplay.c index 4b621b4315..2a3e4853a0 100644 --- a/gtk/gtktextdisplay.c +++ b/gtk/gtktextdisplay.c @@ -538,8 +538,13 @@ render_para (GtkTextRenderer *text_renderer, PANGO_SCALE * x + line_rect.x, PANGO_SCALE * y + baseline); - if (selection_start_index <= byte_offset + line->length && - selection_end_index > byte_offset) /* Some selected */ + /* Check if some part of the line is selected; the newline + * that is after line->length for the last line of the + * paragraph counts as part of the line for this + */ + if ((selection_start_index < byte_offset + line->length || + (selection_start_index == byte_offset + line->length && pango_layout_iter_at_last_line (iter))) && + selection_end_index > byte_offset) { GdkRegion *clip_region = get_selected_clip (text_renderer, layout, line, x + line_display->x_offset, @@ -754,7 +759,7 @@ gtk_text_layout_draw (GtkTextLayout *layout, if (gtk_text_iter_compare (&selection_end, &line_end) <= 0) selection_end_index = gtk_text_iter_get_visible_line_index (&selection_end); else - selection_end_index = MAX(byte_count, 1); + selection_end_index = byte_count + 1; /* + 1 to flag past-the-end */ } }