diff options
| author | Po Lu | 2023-07-02 08:26:54 +0800 |
|---|---|---|
| committer | Po Lu | 2023-07-02 08:26:54 +0800 |
| commit | 2baf2c5fd9abe465a53e035131667e06ef553123 (patch) | |
| tree | 21bcc9909615faf24ea596e61b1f2402e0bd04e8 /src | |
| parent | 3b75148a304f4978c5e43aecf5a2748ecf203ca7 (diff) | |
| parent | 9b9dcc146ba8132ef02afd12f20b302a78c7bbe2 (diff) | |
| download | emacs-2baf2c5fd9abe465a53e035131667e06ef553123.tar.gz emacs-2baf2c5fd9abe465a53e035131667e06ef553123.zip | |
Merge remote-tracking branch 'origin/master' into feature/android
Diffstat (limited to 'src')
| -rw-r--r-- | src/editfns.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/editfns.c b/src/editfns.c index e72d86d84d0..8164316aabe 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -59,6 +59,11 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | |||
| 59 | #ifdef WINDOWSNT | 59 | #ifdef WINDOWSNT |
| 60 | # include "w32common.h" | 60 | # include "w32common.h" |
| 61 | #endif | 61 | #endif |
| 62 | |||
| 63 | #ifdef HAVE_TREE_SITTER | ||
| 64 | #include "treesit.h" | ||
| 65 | #endif | ||
| 66 | |||
| 62 | static void update_buffer_properties (ptrdiff_t, ptrdiff_t); | 67 | static void update_buffer_properties (ptrdiff_t, ptrdiff_t); |
| 63 | static Lisp_Object styled_format (ptrdiff_t, Lisp_Object *, bool); | 68 | static Lisp_Object styled_format (ptrdiff_t, Lisp_Object *, bool); |
| 64 | 69 | ||
| @@ -2399,6 +2404,14 @@ Both characters must have the same length of multi-byte form. */) | |||
| 2399 | if (NILP (noundo)) | 2404 | if (NILP (noundo)) |
| 2400 | record_change (pos, 1); | 2405 | record_change (pos, 1); |
| 2401 | for (i = 0; i < len; i++) *p++ = tostr[i]; | 2406 | for (i = 0; i < len; i++) *p++ = tostr[i]; |
| 2407 | |||
| 2408 | #ifdef HAVE_TREE_SITTER | ||
| 2409 | /* In the previous branch, replace_range() notifies | ||
| 2410 | changes to tree-sitter, but in this branch, we | ||
| 2411 | modified buffer content manually, so we need to | ||
| 2412 | notify tree-sitter manually. */ | ||
| 2413 | treesit_record_change (pos_byte, pos_byte + len, pos_byte + len); | ||
| 2414 | #endif | ||
| 2402 | } | 2415 | } |
| 2403 | last_changed = pos + 1; | 2416 | last_changed = pos + 1; |
| 2404 | } | 2417 | } |
| @@ -2598,6 +2611,15 @@ It returns the number of characters changed. */) | |||
| 2598 | *p++ = *str++; | 2611 | *p++ = *str++; |
| 2599 | signal_after_change (pos, 1, 1); | 2612 | signal_after_change (pos, 1, 1); |
| 2600 | update_compositions (pos, pos + 1, CHECK_BORDER); | 2613 | update_compositions (pos, pos + 1, CHECK_BORDER); |
| 2614 | |||
| 2615 | #ifdef HAVE_TREE_SITTER | ||
| 2616 | /* In the previous branch, replace_range() notifies | ||
| 2617 | changes to tree-sitter, but in this branch, we | ||
| 2618 | modified buffer content manually, so we need to | ||
| 2619 | notify tree-sitter manually. */ | ||
| 2620 | treesit_record_change (pos_byte, pos_byte + len, | ||
| 2621 | pos_byte + len); | ||
| 2622 | #endif | ||
| 2601 | } | 2623 | } |
| 2602 | characters_changed++; | 2624 | characters_changed++; |
| 2603 | } | 2625 | } |
| @@ -4771,6 +4793,13 @@ ring. */) | |||
| 4771 | adjust_markers_bytepos (start1, start1_byte, end2, end2_byte, 0); | 4793 | adjust_markers_bytepos (start1, start1_byte, end2, end2_byte, 0); |
| 4772 | } | 4794 | } |
| 4773 | 4795 | ||
| 4796 | #ifdef HAVE_TREE_SITTER | ||
| 4797 | /* I don't think it's common to transpose two far-apart regions, so | ||
| 4798 | amalgamating the edit into one should be fine. This is what the | ||
| 4799 | signal_after_change below does, too. */ | ||
| 4800 | treesit_record_change (start1_byte, end2_byte, end2_byte); | ||
| 4801 | #endif | ||
| 4802 | |||
| 4774 | signal_after_change (start1, end2 - start1, end2 - start1); | 4803 | signal_after_change (start1, end2 - start1, end2 - start1); |
| 4775 | return Qnil; | 4804 | return Qnil; |
| 4776 | } | 4805 | } |