aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/dispnew.c4
-rw-r--r--src/treesit.c12
2 files changed, 13 insertions, 3 deletions
diff --git a/src/dispnew.c b/src/dispnew.c
index 8fde522f77d..43306043a0c 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -5009,6 +5009,10 @@ update_frame_1 (struct frame *f, bool force_p, bool inhibit_id_p,
5009 } 5009 }
5010 while (row > top && col == 0); 5010 while (row > top && col == 0);
5011 5011
5012 /* We exit the loop with COL at the glyph _after_ the last one. */
5013 if (col > 0)
5014 col--;
5015
5012 /* Make sure COL is not out of range. */ 5016 /* Make sure COL is not out of range. */
5013 if (col >= FRAME_CURSOR_X_LIMIT (f)) 5017 if (col >= FRAME_CURSOR_X_LIMIT (f))
5014 { 5018 {
diff --git a/src/treesit.c b/src/treesit.c
index b210ec0923a..b163685419f 100644
--- a/src/treesit.c
+++ b/src/treesit.c
@@ -2720,8 +2720,10 @@ the query. */)
2720 every for loop and nconc it to RESULT every time. That is indeed 2720 every for loop and nconc it to RESULT every time. That is indeed
2721 the initial implementation in which Yoav found nconc being the 2721 the initial implementation in which Yoav found nconc being the
2722 bottleneck (98.4% of the running time spent on nconc). */ 2722 bottleneck (98.4% of the running time spent on nconc). */
2723 uint32_t patterns_count = ts_query_pattern_count (treesit_query);
2723 Lisp_Object result = Qnil; 2724 Lisp_Object result = Qnil;
2724 Lisp_Object prev_result = result; 2725 Lisp_Object prev_result = result;
2726 Lisp_Object predicates_table = make_vector (patterns_count, Qt);
2725 while (ts_query_cursor_next_match (cursor, &match)) 2727 while (ts_query_cursor_next_match (cursor, &match))
2726 { 2728 {
2727 /* Record the checkpoint that we may roll back to. */ 2729 /* Record the checkpoint that we may roll back to. */
@@ -2750,9 +2752,13 @@ the query. */)
2750 result = Fcons (cap, result); 2752 result = Fcons (cap, result);
2751 } 2753 }
2752 /* Get predicates. */ 2754 /* Get predicates. */
2753 Lisp_Object predicates 2755 Lisp_Object predicates = AREF (predicates_table, match.pattern_index);
2754 = treesit_predicates_for_pattern (treesit_query, 2756 if (EQ (predicates, Qt))
2755 match.pattern_index); 2757 {
2758 predicates = treesit_predicates_for_pattern (treesit_query,
2759 match.pattern_index);
2760 ASET (predicates_table, match.pattern_index, predicates);
2761 }
2756 2762
2757 /* captures_lisp = Fnreverse (captures_lisp); */ 2763 /* captures_lisp = Fnreverse (captures_lisp); */
2758 struct capture_range captures_range = { result, prev_result }; 2764 struct capture_range captures_range = { result, prev_result };