]> git.eshelyaron.com Git - emacs.git/commit
Fix treesit-search-forward
authorYuan Fu <casouri@gmail.com>
Mon, 13 Jun 2022 20:22:17 +0000 (13:22 -0700)
committerYuan Fu <casouri@gmail.com>
Mon, 13 Jun 2022 21:20:25 +0000 (14:20 -0700)
commita73f2b9990465820d80c58ed25208b72731d410d
treef2f71d7a80d6ca1c47ebe3d17e3bab44ade90925
parentc5b172ec586fa5ed0ae0644e1760fcf7ef27dd02
Fix treesit-search-forward

Move the check for movement

    (if (> arg 0)
        ;; Make sure we moved forward.
        (> (funcall pos-fn node) starting-point)
      ;; Make sure we moved backward.
      (< (funcall pos-fn node) starting-point))

into cl-loop:

    if (treesit-node-eq cap-node node)

becomes

    if (and (treesit-node-eq cap-node node)
            (if (> arg 0)
                ;; Make sure we moved forward.
                (> (funcall pos-fn node)
                   starting-point)
              ;; Make sure we moved backward.
              (< (funcall pos-fn node)
                 starting-point)))

* lisp/treesit.el (treesit-search-forward): Move the check.
lisp/treesit.el