diff options
| -rw-r--r-- | src/editfns.c | 13 | ||||
| -rw-r--r-- | test/src/editfns-tests.el | 11 |
2 files changed, 22 insertions, 2 deletions
diff --git a/src/editfns.c b/src/editfns.c index b553a213e6c..fc5b6c117f5 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -3304,8 +3304,17 @@ buffer_chars_equal (struct context *ctx, | |||
| 3304 | eassert (pos_b >= BUF_BEGV (ctx->buffer_b)); | 3304 | eassert (pos_b >= BUF_BEGV (ctx->buffer_b)); |
| 3305 | eassert (pos_b < BUF_ZV (ctx->buffer_b)); | 3305 | eassert (pos_b < BUF_ZV (ctx->buffer_b)); |
| 3306 | 3306 | ||
| 3307 | return BUF_FETCH_CHAR_AS_MULTIBYTE (ctx->buffer_a, pos_a) | 3307 | ptrdiff_t bpos_a = |
| 3308 | == BUF_FETCH_CHAR_AS_MULTIBYTE (ctx->buffer_b, pos_b); | 3308 | NILP (BVAR (ctx->buffer_a, enable_multibyte_characters)) |
| 3309 | ? pos_a | ||
| 3310 | : buf_charpos_to_bytepos (ctx->buffer_a, pos_a); | ||
| 3311 | ptrdiff_t bpos_b = | ||
| 3312 | NILP (BVAR (ctx->buffer_b, enable_multibyte_characters)) | ||
| 3313 | ? pos_b | ||
| 3314 | : buf_charpos_to_bytepos (ctx->buffer_b, pos_b); | ||
| 3315 | |||
| 3316 | return BUF_FETCH_CHAR_AS_MULTIBYTE (ctx->buffer_a, bpos_a) | ||
| 3317 | == BUF_FETCH_CHAR_AS_MULTIBYTE (ctx->buffer_b, bpos_b); | ||
| 3309 | } | 3318 | } |
| 3310 | 3319 | ||
| 3311 | 3320 | ||
diff --git a/test/src/editfns-tests.el b/test/src/editfns-tests.el index 714e92e5053..ec411ff773b 100644 --- a/test/src/editfns-tests.el +++ b/test/src/editfns-tests.el | |||
| @@ -247,6 +247,17 @@ | |||
| 247 | (buffer-string) | 247 | (buffer-string) |
| 248 | "foo bar baz qux")))))) | 248 | "foo bar baz qux")))))) |
| 249 | 249 | ||
| 250 | (ert-deftest replace-buffer-contents-bug31837 () | ||
| 251 | (switch-to-buffer "a") | ||
| 252 | (insert-char (char-from-name "SMILE")) | ||
| 253 | (insert "1234") | ||
| 254 | (switch-to-buffer "b") | ||
| 255 | (insert-char (char-from-name "SMILE")) | ||
| 256 | (insert "5678") | ||
| 257 | (replace-buffer-contents "a") | ||
| 258 | (should (equal (buffer-substring-no-properties (point-min) (point-max)) | ||
| 259 | (concat (string (char-from-name "SMILE")) "1234")))) | ||
| 260 | |||
| 250 | (ert-deftest delete-region-undo-markers-1 () | 261 | (ert-deftest delete-region-undo-markers-1 () |
| 251 | "Make sure we don't end up with freed markers reachable from Lisp." | 262 | "Make sure we don't end up with freed markers reachable from Lisp." |
| 252 | ;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=30931#40 | 263 | ;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=30931#40 |