[gtk/wip/exalm/textview-selection: 1/4] textlayout: Don't draw ends of the line for selection




commit 968faca5392fffe5f44fd2096bf21fff08fd9629
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Mon May 3 18:59:35 2021 +0500

    textlayout: Don't draw ends of the line for selection
    
    That area is already drawn as part of the selection bounds, don't draw it
    again.

 gtk/gtktextlayout.c | 28 ----------------------------
 1 file changed, 28 deletions(-)
---
diff --git a/gtk/gtktextlayout.c b/gtk/gtktextlayout.c
index d127c489b2..20ef614437 100644
--- a/gtk/gtktextlayout.c
+++ b/gtk/gtktextlayout.c
@@ -3938,34 +3938,6 @@ render_para (GskPangoRenderer   *crenderer,
                 }
 
               g_free (ranges);
-
-              /* Paint in the ends of the line */
-              if (line_rect.x > line_display->left_margin * PANGO_SCALE &&
-                  ((line_display->direction == GTK_TEXT_DIR_LTR && selection_start_index < byte_offset) ||
-                   (line_display->direction == GTK_TEXT_DIR_RTL && selection_end_index > byte_offset + 
line->length)))
-                gtk_snapshot_append_color (crenderer->snapshot,
-                                           selection,
-                                           &GRAPHENE_RECT_INIT (line_display->left_margin,
-                                                                selection_y,
-                                                                PANGO_PIXELS (line_rect.x) - 
line_display->left_margin,
-                                                                selection_height));
-
-              if (line_rect.x + line_rect.width <
-                  (screen_width + line_display->left_margin) * PANGO_SCALE &&
-                  ((line_display->direction == GTK_TEXT_DIR_LTR && selection_end_index > byte_offset + 
line->length) ||
-                   (line_display->direction == GTK_TEXT_DIR_RTL && selection_start_index < byte_offset)))
-                {
-                  int nonlayout_width = line_display->left_margin
-                                      + screen_width
-                                      - PANGO_PIXELS (line_rect.x)
-                                      - PANGO_PIXELS (line_rect.width);
-                  gtk_snapshot_append_color (crenderer->snapshot,
-                                             selection,
-                                             &GRAPHENE_RECT_INIT (PANGO_PIXELS (line_rect.x) + PANGO_PIXELS 
(line_rect.width),
-                                                                  selection_y,
-                                                                  nonlayout_width,
-                                                                  selection_height));
-                }
             }
           else if (line_display->has_block_cursor &&
                    gtk_widget_has_focus (crenderer->widget) &&


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]