mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2026-09-10 07:46:51 -04:00
Fix treesit_cursor_helper_1 for zero-width nodes (bug#81436)
* lisp/treesit.el (treesit--some): Add edebug declare. * src/treesit.c (treesit_cursor_helper_1): Don't use ts_tree_cursor_goto_first_child_for_byte for zero-width nodes.
This commit is contained in:
parent
6b670907fa
commit
29bbd02347
|
|
@ -3810,7 +3810,7 @@ the current line if the beginning of the defun is indented."
|
|||
Return the first non-nil evaluation of BODY.
|
||||
|
||||
\(fn (SYM VAL) &rest BODY)"
|
||||
(declare (indent 1))
|
||||
(declare (indent 1) (debug ((symbolp form) body)))
|
||||
(let ((result-sym (gensym))
|
||||
(val-sym (gensym))
|
||||
(sym (car sym-val))
|
||||
|
|
|
|||
|
|
@ -4259,9 +4259,13 @@ treesit_cursor_helper_1 (TSTreeCursor *cursor, TSNode *target,
|
|||
return true;
|
||||
|
||||
/* ts_tree_cursor_goto_first_child_for_byte is significantly faster,
|
||||
so despite it having problems (see bug#60127), we try it
|
||||
first. */
|
||||
if (ts_tree_cursor_goto_first_child_for_byte (cursor, start_pos) == -1
|
||||
so despite it having problems (see bug#60127), we try it first.
|
||||
Also, ts_tree_cursor_goto_first_child_for_byte can't find
|
||||
zero-width nodes (which exists and are legit, e.g., markdown's
|
||||
block_continuation), because a zero-width node can't contain a pos
|
||||
(end > pos). */
|
||||
if (start_pos != end_pos
|
||||
&& ts_tree_cursor_goto_first_child_for_byte (cursor, start_pos) == -1
|
||||
&& !ts_tree_cursor_goto_first_child (cursor))
|
||||
return false;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue