emacs-31 5dd8fe25c23: Correct cursor range in Ftreesit_query_capture (bug#81297)
Yuan Fu <[email protected]> Wed, 1 Jul 2026 01:44:55 -0400 (EDT)
| Newsgroups | gmane.emacs.diffs |
|---|---|
| Message-ID | <[email protected]> |
branch: emacs-31 commit 5dd8fe25c23944cb8ac97d2d54b946c6a394d0fb Author: Yuan Fu <[email protected]> Commit: Yuan Fu <[email protected]> Correct cursor range in Ftreesit_query_capture (bug#81297) * src/treesit.c (Ftreesit_query_capture): Always explicitly set cursor's range. --- src/treesit.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/treesit.c b/src/treesit.c index 3d342be3dcc..55e6f8b94a1 100644 --- a/src/treesit.c +++ b/src/treesit.c @@ -4106,6 +4106,12 @@ the query. */) (uint32_t) (beg_byte - visible_beg), (uint32_t) (end_byte - visible_beg)); } + else + { + /* If range is unbounded, set it explicitly, in case the cursor is + reused and carries the range from last call. */ + ts_query_cursor_set_byte_range (cursor, 0, UINT32_MAX); + } /* Execute query. */ ts_query_cursor_exec (cursor, treesit_query, treesit_node);