aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYuan Fu2023-01-25 23:12:41 -0800
committerYuan Fu2023-01-25 23:14:35 -0800
commit4bd06ce2a9fa1601aff5a5fcab7411e5fce20d28 (patch)
treee8cc5e8fceeb3dd44a748fa85fc6a1176f360f4f
parent00675aa724a6e18d03c2ccc63269ef03c67086ec (diff)
downloademacs-4bd06ce2a9fa1601aff5a5fcab7411e5fce20d28.tar.gz
emacs-4bd06ce2a9fa1601aff5a5fcab7411e5fce20d28.zip
Fix call to treesit_record_change in insdel.c
The start position of the change shouldn't be PT_BYTE, IIUC PT_BYTE is actually the end position. * src/insdel.c (insert_from_buffer): Move to here. (insert_from_buffer_1): Remove call to treesit_record_change.
-rw-r--r--src/insdel.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/insdel.c b/src/insdel.c
index b51767bf527..33dea569b24 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -1175,9 +1175,19 @@ insert_from_buffer (struct buffer *buf,
1175{ 1175{
1176 ptrdiff_t opoint = PT; 1176 ptrdiff_t opoint = PT;
1177 1177
1178#ifdef HAVE_TREE_SITTER
1179 ptrdiff_t obyte = PT_BYTE;
1180#endif
1181
1178 insert_from_buffer_1 (buf, charpos, nchars, inherit); 1182 insert_from_buffer_1 (buf, charpos, nchars, inherit);
1179 signal_after_change (opoint, 0, PT - opoint); 1183 signal_after_change (opoint, 0, PT - opoint);
1180 update_compositions (opoint, PT, CHECK_BORDER); 1184 update_compositions (opoint, PT, CHECK_BORDER);
1185
1186#ifdef HAVE_TREE_SITTER
1187 eassert (PT_BYTE >= 0);
1188 eassert (PT_BYTE >= obyte);
1189 treesit_record_change (obyte, obyte, PT_BYTE);
1190#endif
1181} 1191}
1182 1192
1183static void 1193static void
@@ -1305,12 +1315,6 @@ insert_from_buffer_1 (struct buffer *buf,
1305 /* Insert those intervals. */ 1315 /* Insert those intervals. */
1306 graft_intervals_into_buffer (intervals, PT, nchars, current_buffer, inherit); 1316 graft_intervals_into_buffer (intervals, PT, nchars, current_buffer, inherit);
1307 1317
1308#ifdef HAVE_TREE_SITTER
1309 eassert (outgoing_nbytes >= 0);
1310 eassert (PT_BYTE >= 0);
1311 treesit_record_change (PT_BYTE, PT_BYTE, PT_BYTE + outgoing_nbytes);
1312#endif
1313
1314 adjust_point (nchars, outgoing_nbytes); 1318 adjust_point (nchars, outgoing_nbytes);
1315} 1319}
1316 1320