Files
emacs/src
Yuan Fu 6a6d7925c9 Fix range handling so it works for multibyte buffer (bug#73204)
Here by multibyte buffer I mean buffer that includes non-ASCII
characters.

The problem is illustrated by this comment, which I copied from the
source:

======================================================================
(ref:bytepos-range-pitfall) Suppose we have the following buffer
content ([ ] is a unibyte char, [    ] is a multibyte char):

    [a][b][c][d][e][ f  ]

and the following ranges (denoted by braces):

    [a][b][c][d][e][ f  ]
    {       }{    }

So far so good, now user deletes a unibyte char at the beginning:

    [b][c][d][e][ f  ]
    {       }{    }

Oops, now our range cuts into the multibyte char, bad!
======================================================================

* src/treesit.c (treesit_debug_print_parser_list): Minor fix.
(treesit_sync_visible_region): Change the way we fixup ranges, instead
of using the bytepos ranges from tree-sitter, we use the cached lisp
charpos ranges.
(treesit_make_ts_ranges): New function.
(Ftreesit_parser_set_included_ranges): Refactor out the new function
treesit_make_ts_ranges.
(Ftreesit_parser_included_ranges): Rather than getting the ranges from
tree-sitter, just return the cached lisp ranges.

* src/treesit.h (Lisp_TS_Parser): Add some comment.
* test/src/treesit-tests.el (treesit-range-fixup-after-edit): New test.
2024-09-14 00:28:23 -07:00
..
2024-01-02 10:28:14 +08:00
2024-07-18 11:46:50 +02:00
2024-05-19 09:38:50 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 10:28:14 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 10:28:14 +08:00
2024-01-02 09:47:10 +08:00
2024-01-13 20:50:38 +01:00
2024-01-02 09:47:10 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 10:28:14 +08:00
2024-01-02 10:28:14 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 09:47:10 +08:00
2024-07-18 11:46:50 +02:00
2024-01-02 09:47:10 +08:00
2024-01-02 09:47:10 +08:00
2024-06-16 22:38:26 +02:00
2024-07-18 11:46:50 +02:00
2024-07-18 11:46:50 +02:00
2024-01-02 10:28:14 +08:00
2024-06-05 19:32:17 +03:00
2024-01-02 09:47:10 +08:00
2024-06-14 21:42:18 +03:00
2024-01-02 09:47:10 +08:00
2024-07-18 11:46:50 +02:00
2024-01-02 09:47:10 +08:00
2024-03-09 04:18:53 -05:00
2024-02-15 22:13:04 +08:00
2024-01-02 09:47:10 +08:00
2024-05-14 10:18:04 +02:00
2024-01-02 09:47:10 +08:00
2024-07-09 22:02:22 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 10:28:14 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 10:28:14 +08:00
2024-08-17 11:04:43 +03:00
2024-01-02 09:47:10 +08:00
2024-08-03 19:32:23 +02:00
2024-01-02 09:47:10 +08:00
2024-01-02 10:28:14 +08:00
2024-01-02 10:28:14 +08:00
2024-06-16 22:38:26 +02:00
2024-01-02 09:47:10 +08:00
2024-01-02 10:28:14 +08:00
2024-01-02 09:47:10 +08:00
2024-08-03 17:09:49 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 10:28:14 +08:00
2024-05-12 13:27:43 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 10:28:14 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 10:28:14 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 10:28:14 +08:00
2024-01-02 10:28:14 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 10:28:14 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 10:28:14 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 09:47:10 +08:00
2024-08-17 11:04:43 +03:00
2024-06-04 22:16:28 -07:00
2024-01-02 10:28:14 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 10:28:14 +08:00
2024-05-12 15:04:47 +02:00
2024-01-02 09:47:10 +08:00
2024-01-02 09:47:10 +08:00
2024-07-18 11:46:50 +02:00
2024-01-02 09:47:10 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 09:47:10 +08:00
2024-09-12 08:23:13 +08:00
2024-03-18 09:32:53 -04:00
2024-01-02 09:47:10 +08:00
2024-01-02 09:47:10 +08:00
2024-05-19 08:58:15 -07:00
2024-01-02 10:28:14 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 10:28:14 +08:00
2024-01-02 10:30:05 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 09:47:10 +08:00
2024-06-04 22:16:28 -07:00
2024-01-02 10:28:14 +08:00
2024-01-02 10:28:14 +08:00
2024-01-02 10:28:14 +08:00
2024-04-23 10:02:39 +03:00
2024-01-02 09:47:10 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 10:28:14 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 10:28:14 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 09:47:10 +08:00
2024-07-18 11:46:50 +02:00
2024-06-22 20:42:55 -04:00
2024-01-02 10:28:14 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 09:47:10 +08:00
2024-08-17 22:04:01 +08:00
2024-01-02 09:47:10 +08:00
2024-06-23 16:28:22 +08:00
2024-01-02 09:47:10 +08:00
2024-06-01 08:34:43 -04:00
2024-01-02 09:47:10 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 10:28:14 +08:00
2024-01-02 09:47:10 +08:00
2024-06-23 16:40:06 +02:00
2024-01-02 10:28:14 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 10:28:14 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 09:47:10 +08:00
2024-01-02 10:28:14 +08:00
2024-08-17 21:53:30 +08:00
2024-06-19 14:30:17 +03:00
2024-01-02 09:47:10 +08:00

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
Copyright (C) 2001-2024 Free Software Foundation, Inc.
See the end of the file for license conditions.


This directory contains the source files for the C component of GNU Emacs.
Nothing in this directory is needed for using Emacs once it is built
and installed, if the dumped Emacs is copied elsewhere.

See the files ../README and then ../INSTALL for installation instructions.

The file 'Makefile.in' is used as a template by the script
'../configure' to produce 'Makefile'.  This is the file which actually
controls the compilation of Emacs C source files.  All of this should
work transparently; you should only need to change to the parent
directory, run './configure', and then run 'make'.

This file is part of GNU Emacs.

GNU Emacs is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.