]> git.eshelyaron.com Git - emacs.git/commit
Fix treesit_sync_visible_region's range fixup code (bug#73264)
authorYuan Fu <casouri@gmail.com>
Sun, 15 Sep 2024 07:24:03 +0000 (00:24 -0700)
committerEshel Yaron <me@eshelyaron.com>
Mon, 23 Sep 2024 10:45:12 +0000 (12:45 +0200)
commit149d6a851701accac71555822cea8ee5e3e3b54e
treec3a1a5dea3b0d839dd8801bed2576624a860fb01
parent1d45d467d96f56ae968e9a35f5371de2cd0fbf90
Fix treesit_sync_visible_region's range fixup code (bug#73264)

      new_ranges_head
      |
      v
( )->( )->( )->( )->( )
           ^    ^
           |    |
           |    lisp_ranges (loop head)
           |
           prev_cons -> set cdr to nil to cut of the rest

result:

     ( )->( )

* src/treesit.c (treesit_sync_visible_region): Cut off this cons and the
rest, not set the current range's end to nil.
* test/src/treesit-tests.el:
(treesit-range-fixup-after-edit): Add tests for all cases.

(cherry picked from commit 460b9d705ab482003fabe75b0fd1df223abe467c)
src/treesit.c
test/src/treesit-tests.el