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 f31e185a84b..19261ef79e8 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -5016,6 +5016,10 @@ update_frame_1 (struct frame *f, bool force_p, bool inhibit_id_p,
5016 } 5016 }
5017 while (row > top && col == 0); 5017 while (row > top && col == 0);
5018 5018
5019 /* We exit the loop with COL at the glyph _after_ the last one. */
5020 if (col > 0)
5021 col--;
5022
5019 /* Make sure COL is not out of range. */ 5023 /* Make sure COL is not out of range. */
5020 if (col >= FRAME_CURSOR_X_LIMIT (f)) 5024 if (col >= FRAME_CURSOR_X_LIMIT (f))
5021 { 5025 {
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 };