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 Make force-load-doc-strings work again 2022-08-07 10:25:03 +02:00
regex-resources * src/regex-emacs.c (analyze_first): Fix incorrect optimization 2023-09-27 13:29:50 -04:00
syntax-resources Enhance syntax-tests.el to test nestable comments (Lisp style) 2020-11-17 16:51:49 +00:00
alloc-tests.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
buffer-tests.el Standardize possessive apostrophe usage in manuals, docs, and comments 2024-07-25 03:35:18 +02:00
callint-tests.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
callproc-tests.el Standardize possessive apostrophe usage in manuals, docs, and comments 2024-07-25 03:35:18 +02:00
casefiddle-tests.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
character-tests.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
charset-tests.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
chartab-tests.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
cmds-tests.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
coding-tests.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
comp-tests.el ; Fix typos in symbols 2024-06-29 17:29:38 +02:00
data-tests.el cl-preloaded.el: Partly revert last change 2024-03-26 17:27:29 -04:00
decompress-tests.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
doc-tests.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
editfns-tests.el ; Fix whitespace in editfns-tests.el 2024-04-11 08:55:12 +03:00
emacs-module-tests.el Fix recent test regressions 2024-03-22 18:44:54 -04:00
emacs-tests.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
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 ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
fns-tests.el Fix value< string comparison ungoodthink 2024-04-29 14:29:52 +02:00
font-tests.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
image-tests.el Fix two tests for --without-all build 2024-06-27 15:32:51 +02:00
indent-tests.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
inotify-tests.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
json-tests.el Make json-serialize always return a unibyte string (bug#70007) 2024-09-08 20:02:34 +02:00
keyboard-tests.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
keymap-tests.el Add multi/unibyte string tests for key-description 2024-05-16 14:29:10 +02:00
lcms-tests.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
lread-tests.el `read': give fuller error message for errors following "#". 2024-05-06 20:14:57 +00:00
marker-tests.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
minibuf-tests.el Use obarray-make instead of make-vector to create obarrays 2024-02-23 13:02:27 +01:00
print-tests.el * src/print.c (print_object): Don't print empty hash-table data 2024-01-13 20:50:37 +01:00
process-tests.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
regex-emacs-tests.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
search-tests.el (test-replace-match-modification-hooks): Delete test 2024-04-09 11:01:36 -04:00
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 Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
textprop-tests.el Fix deletion of text holding `inhibit-read-only' properties 2024-04-30 18:28:05 +08:00
thread-tests.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
timefns-tests.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
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 Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
xdisp-tests.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
xfaces-tests.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
xml-tests.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00