all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: Theodor Thornhill <theo@thornhill.no>,
	Mickey Petersen <mickey@masteringemacs.org>
Cc: Eli Zaretskii <eliz@gnu.org>, 61529@debbugs.gnu.org
Subject: bug#61529: 30.0.50; tree-sitter: weird off-by-one error but only in css-ts-mode(?) with `treesit-node-at'
Date: Thu, 16 Feb 2023 23:34:58 +0200	[thread overview]
Message-ID: <4997c960-5a29-1004-6727-df69d22a9d37@yandex.ru> (raw)
In-Reply-To: <87cz6a7p5d.fsf@thornhill.no>

On 15/02/2023 20:35, Theodor Thornhill via Bug reports for GNU Emacs, 
the Swiss army knife of text editors wrote:
> So the docstring of treesit-node-at states:

Looking at the code, this change might describe it better:

diff --git a/lisp/treesit.el b/lisp/treesit.el
index 749781894b8..6e53b3d4c4a 100644
--- a/lisp/treesit.el
+++ b/lisp/treesit.el
@@ -166,10 +166,13 @@ treesit-node-at
  A leaf node is a node that doesn't have any child nodes.

  The returned node's span covers POS: the node's beginning is before
-or at POS, and the node's end is at or after POS.
+or at POS, and the node's end is after POS.

-If no leaf node's span covers POS (e.g., POS is on whitespace
-between two leaf nodes), return the first leaf node after POS.
+If no such node is found, but a leaf node ends at POS, it's
+returned.
+
+Otherwise (e.g., when POS is on whitespace between two leaf
+nodes), return the first leaf node after POS.

  If there is no leaf node after POS, return the first leaf node
  before POS.






  parent reply	other threads:[~2023-02-16 21:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-15  8:25 bug#61529: 30.0.50; tree-sitter: weird off-by-one error but only in css-ts-mode(?) with `treesit-node-at' Mickey Petersen
2023-02-15 13:42 ` Eli Zaretskii
2023-02-15 13:42   ` Mickey Petersen
2023-02-15 18:35     ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-15 19:01       ` Mickey Petersen
2023-02-15 19:42         ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-16 19:48           ` Mickey Petersen
2023-02-16 21:26         ` Dmitry Gutov
2023-02-16 21:34       ` Dmitry Gutov [this message]
2023-02-17  6:16         ` Eli Zaretskii
2023-02-17  7:24           ` Mickey Petersen
2023-02-17 15:11           ` Dmitry Gutov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4997c960-5a29-1004-6727-df69d22a9d37@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=61529@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=mickey@masteringemacs.org \
    --cc=theo@thornhill.no \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.