[gtksourceview/wip/chergert/gsv-gtk4: 162/172] gutterlines: short-circuit line check



commit 02e286c88702c292c5643c15a6c4899cfef627cd
Author: Christian Hergert <chergert redhat com>
Date:   Fri Apr 17 14:12:40 2020 -0700

    gutterlines: short-circuit line check
    
    This is faster than checking for a quark in an inline set.

 gtksourceview/gtksourcegutterlines.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/gtksourceview/gtksourcegutterlines.c b/gtksourceview/gtksourcegutterlines.c
index fea9c692..df9b9bc7 100644
--- a/gtksourceview/gtksourcegutterlines.c
+++ b/gtksourceview/gtksourcegutterlines.c
@@ -456,7 +456,8 @@ gboolean
 gtk_source_gutter_lines_is_cursor (GtkSourceGutterLines *lines,
                                    guint                 line)
 {
-       return gtk_source_gutter_lines_has_qclass (lines, line, q_cursor_line);
+       return line == lines->cursor_line ||
+              gtk_source_gutter_lines_has_qclass (lines, line, q_cursor_line);
 }
 
 /**


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