summaryrefslogtreecommitdiff
path: root/src/marker.c
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2019-05-07 13:41:54 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2019-05-07 13:41:54 -0400
commit32cf07819ae8cfdbf14e00f351c7f520fff325c3 (patch)
tree029f5e0b51aa8052bba25d79bb9fba9fb42ecee6 /src/marker.c
parent81d83cf6357c73ac5e8de8aeac9760ab00f5af0a (diff)
downloademacs-32cf07819ae8cfdbf14e00f351c7f520fff325c3.tar.gz
* src/marker.c (buf_bytepos_to_charpos): Re-add the CHAR_HEAD_P assertion
This assertion was removed in 1c349c62305d432abf0fa2b6e3f5d754fe4cab79 because the assumption was invalid during set_intervals_multibyte_1. So we change set_intervals_multibyte_1 to solve the problem in the same way as in the rest of Fset_buffer_multibyte, which actually simplifies the code. * src/buffer.c (advance_to_char_boundary): Not static any more. * src/buffer.h (advance_to_char_boundary): Add prototype. * src/intervals.c (set_intervals_multibyte_1): Use it.
Diffstat (limited to 'src/marker.c')
-rw-r--r--src/marker.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/marker.c b/src/marker.c
index b58051a8c2b..0b2e1bf5c6b 100644
--- a/src/marker.c
+++ b/src/marker.c
@@ -332,6 +332,10 @@ buf_bytepos_to_charpos (struct buffer *b, ptrdiff_t bytepos)
if (best_above == best_above_byte)
return bytepos;
+ /* Check bytepos is not in the middle of a character. */
+ eassert (bytepos >= BUF_Z_BYTE (b)
+ || CHAR_HEAD_P (BUF_FETCH_BYTE (b, bytepos)));
+
best_below = BEG;
best_below_byte = BEG_BYTE;