aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2023-06-29 21:23:12 +0300
committerEli Zaretskii2023-06-29 21:23:12 +0300
commita722e7dd152b809b0e71be30f83606490794c1c7 (patch)
tree6dde93bab3279b0ceef21257fe77f9fb0f5ce35f /src
parent65f146cf1c275cfce2265a5911c6460374ef153b (diff)
parent1d2ba6b363b2e41ca40c74f679f80363e04a54ed (diff)
downloademacs-a722e7dd152b809b0e71be30f83606490794c1c7.tar.gz
emacs-a722e7dd152b809b0e71be30f83606490794c1c7.zip
Merge branch 'emacs-29' of git.savannah.gnu.org:/srv/git/emacs into emacs-29
Diffstat (limited to 'src')
-rw-r--r--src/editfns.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/editfns.c b/src/editfns.c
index d02cce4aef3..a1e48daf6c6 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -55,6 +55,11 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
55#ifdef WINDOWSNT 55#ifdef WINDOWSNT
56# include "w32common.h" 56# include "w32common.h"
57#endif 57#endif
58
59#ifdef HAVE_TREE_SITTER
60#include "treesit.h"
61#endif
62
58static void update_buffer_properties (ptrdiff_t, ptrdiff_t); 63static void update_buffer_properties (ptrdiff_t, ptrdiff_t);
59static Lisp_Object styled_format (ptrdiff_t, Lisp_Object *, bool); 64static Lisp_Object styled_format (ptrdiff_t, Lisp_Object *, bool);
60 65
@@ -2391,6 +2396,14 @@ Both characters must have the same length of multi-byte form. */)
2391 if (NILP (noundo)) 2396 if (NILP (noundo))
2392 record_change (pos, 1); 2397 record_change (pos, 1);
2393 for (i = 0; i < len; i++) *p++ = tostr[i]; 2398 for (i = 0; i < len; i++) *p++ = tostr[i];
2399
2400#ifdef HAVE_TREE_SITTER
2401 /* In the previous branch, replace_range() notifies
2402 changes to tree-sitter, but in this branch, we
2403 modified buffer content manually, so we need to
2404 notify tree-sitter manually. */
2405 treesit_record_change (pos_byte, pos_byte + len, pos_byte + len);
2406#endif
2394 } 2407 }
2395 last_changed = pos + 1; 2408 last_changed = pos + 1;
2396 } 2409 }
@@ -2590,6 +2603,15 @@ It returns the number of characters changed. */)
2590 *p++ = *str++; 2603 *p++ = *str++;
2591 signal_after_change (pos, 1, 1); 2604 signal_after_change (pos, 1, 1);
2592 update_compositions (pos, pos + 1, CHECK_BORDER); 2605 update_compositions (pos, pos + 1, CHECK_BORDER);
2606
2607#ifdef HAVE_TREE_SITTER
2608 /* In the previous branch, replace_range() notifies
2609 changes to tree-sitter, but in this branch, we
2610 modified buffer content manually, so we need to
2611 notify tree-sitter manually. */
2612 treesit_record_change (pos_byte, pos_byte + len,
2613 pos_byte + len);
2614#endif
2593 } 2615 }
2594 characters_changed++; 2616 characters_changed++;
2595 } 2617 }
@@ -4763,6 +4785,13 @@ ring. */)
4763 adjust_markers_bytepos (start1, start1_byte, end2, end2_byte, 0); 4785 adjust_markers_bytepos (start1, start1_byte, end2, end2_byte, 0);
4764 } 4786 }
4765 4787
4788#ifdef HAVE_TREE_SITTER
4789 /* I don't think it's common to transpose two far-apart regions, so
4790 amalgamating the edit into one should be fine. This is what the
4791 signal_after_change below does, too. */
4792 treesit_record_change (start1_byte, end2_byte, end2_byte);
4793#endif
4794
4766 signal_after_change (start1, end2 - start1, end2 - start1); 4795 signal_after_change (start1, end2 - start1, end2 - start1);
4767 return Qnil; 4796 return Qnil;
4768} 4797}