X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/a985d2b09bb88f31b27b02c3131cb34c5879d767..00b6647651e4276ac5c47aa33e0fec6726469bc7:/src/editfns.c diff --git a/src/editfns.c b/src/editfns.c index 0c01c748d2..aed884ebe1 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -4175,13 +4175,13 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message) convbytes += padding; if (convbytes <= buf + bufsize - p) { - info[n].start = nchars; if (! minus_flag) { memset (p, ' ', padding); p += padding; nchars += padding; } + info[n].start = nchars; if (p > buf && multibyte @@ -4631,7 +4631,7 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message) len = make_number (SCHARS (args[i])); Lisp_Object new_len = make_number (info[i].end - info[i].start); props = text_property_list (args[i], make_number (0), len, Qnil); - props = extend_property_ranges (props, new_len); + props = extend_property_ranges (props, len, new_len); /* If successive arguments have properties, be sure that the value of `composition' property be the copy. */ if (1 < i && info[i - 1].end) @@ -5058,6 +5058,14 @@ Transposing beyond buffer boundaries is an error. */) start2_byte, start2_byte + len2_byte); fix_start_end_in_overlays (start1, end2); } + else + { + /* The character positions of the markers remain intact, but we + still need to update their byte positions, because the + transposed regions might include multibyte sequences which + make some original byte positions of the markers invalid. */ + adjust_markers_bytepos (start1, start1_byte, end2, end2_byte, 0); + } signal_after_change (start1, end2 - start1, end2 - start1); return Qnil;