Don't paint in the trailing end of a wrapped line when the selection

Tue Nov 30 16:25:29 2004  Owen Taylor  <otaylor@redhat.com>

        * 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.
This commit is contained in:
Owen Taylor 2004-11-30 21:33:36 +00:00 committed by Owen Taylor
parent 1b45c64014
commit 126efafc40
5 changed files with 52 additions and 3 deletions

View File

@ -1,3 +1,14 @@
Tue Nov 30 16:25:29 2004 Owen Taylor <otaylor@redhat.com>
* 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 <jcape@ignore-your.tv>
* gtk/gtkfilechooserbutton.h (gtk_file_chooser_button_get_active)

View File

@ -1,3 +1,14 @@
Tue Nov 30 16:25:29 2004 Owen Taylor <otaylor@redhat.com>
* 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 <jcape@ignore-your.tv>
* gtk/gtkfilechooserbutton.h (gtk_file_chooser_button_get_active)

View File

@ -1,3 +1,14 @@
Tue Nov 30 16:25:29 2004 Owen Taylor <otaylor@redhat.com>
* 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 <jcape@ignore-your.tv>
* gtk/gtkfilechooserbutton.h (gtk_file_chooser_button_get_active)

View File

@ -1,3 +1,14 @@
Tue Nov 30 16:25:29 2004 Owen Taylor <otaylor@redhat.com>
* 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 <jcape@ignore-your.tv>
* gtk/gtkfilechooserbutton.h (gtk_file_chooser_button_get_active)

View File

@ -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 */
}
}