From 85c0ed4a0f5fbce07544c8c03885623299567c19 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 18 Jul 2024 12:59:28 +0300 Subject: [PATCH] Minor cleanup of code in insdel.c * src/insdel.c (del_range_2): Update *_BYTE variables _after_ updating the corresponding character values. This follows what we do everywhere else, and allows to put a watchpoint on, say, Z_BYTE to check consistency between the character and byte counts. See bug#72165 for one situation where it is useful. (cherry picked from commit a90a1ed527e89cf26737b6a123070c55c3118923) --- src/insdel.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/insdel.c b/src/insdel.c index c450959eec6..26ad14948ce 100644 --- a/src/insdel.c +++ b/src/insdel.c @@ -1929,10 +1929,10 @@ del_range_2 (ptrdiff_t from, ptrdiff_t from_byte, offset_intervals (current_buffer, from, - nchars_del); GAP_SIZE += nbytes_del; - ZV_BYTE -= nbytes_del; - Z_BYTE -= nbytes_del; ZV -= nchars_del; Z -= nchars_del; + ZV_BYTE -= nbytes_del; + Z_BYTE -= nbytes_del; GPT = from; GPT_BYTE = from_byte; if (GAP_SIZE > 0 && !current_buffer->text->inhibit_shrinking) -- 2.39.5