1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-02-12 18:55:13 -08:00
emacs/test/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
..
comp-resources ; Fix typos in symbols 2024-06-29 17:29:38 +02:00
emacs-module-resources Silence some macOS build warnings 2024-05-12 15:04:47 +02:00
lread-resources
regex-resources
syntax-resources
alloc-tests.el
buffer-tests.el Standardize possessive apostrophe usage in manuals, docs, and comments 2024-07-25 03:35:18 +02:00
callint-tests.el
callproc-tests.el Standardize possessive apostrophe usage in manuals, docs, and comments 2024-07-25 03:35:18 +02:00
casefiddle-tests.el
character-tests.el
charset-tests.el
chartab-tests.el
cmds-tests.el
coding-tests.el
comp-tests.el ; Fix typos in symbols 2024-06-29 17:29:38 +02:00
data-tests.el
decompress-tests.el
doc-tests.el
editfns-tests.el ; Fix whitespace in editfns-tests.el 2024-04-11 08:55:12 +03:00
emacs-module-tests.el
emacs-tests.el
eval-tests.el Fix missing type checks before specbind 2024-08-03 19:32:23 +02:00
fileio-tests.el Merge from origin/emacs-29 2024-05-25 08:00:48 -04:00
filelock-tests.el Standardize possessive apostrophe usage in manuals, docs, and comments 2024-07-25 03:35:18 +02:00
floatfns-tests.el
fns-tests.el Fix value< string comparison ungoodthink 2024-04-29 14:29:52 +02:00
font-tests.el
image-tests.el Fix two tests for --without-all build 2024-06-27 15:32:51 +02:00
indent-tests.el
inotify-tests.el
json-tests.el Make json-serialize always return a unibyte string (bug#70007) 2024-09-08 20:02:34 +02:00
keyboard-tests.el
keymap-tests.el Add multi/unibyte string tests for key-description 2024-05-16 14:29:10 +02:00
lcms-tests.el
lread-tests.el `read': give fuller error message for errors following "#". 2024-05-06 20:14:57 +00:00
marker-tests.el
minibuf-tests.el
print-tests.el
process-tests.el
regex-emacs-tests.el
search-tests.el
sqlite-tests.el * test/src/sqlite-tests.el (sqlite-execute-batch): Declare to wave warning. 2024-07-10 10:24:46 +02:00
syntax-tests.el
textprop-tests.el Fix deletion of text holding `inhibit-read-only' properties 2024-04-30 18:28:05 +08:00
thread-tests.el
timefns-tests.el
treesit-tests.el Fix range handling so it works for multibyte buffer (bug#73204) 2024-09-14 00:28:23 -07:00
undo-tests.el
xdisp-tests.el
xfaces-tests.el
xml-tests.el