aboutsummaryrefslogtreecommitdiffstats
path: root/src/buffer.c
diff options
context:
space:
mode:
authorStephen Berman2026-02-12 18:48:20 +0100
committerStephen Berman2026-02-12 18:48:20 +0100
commitf8a25d00ae45a3362b08a999026835fde85f6ef0 (patch)
treea3ec79441ee6222ae7692effbe914abcad2221b1 /src/buffer.c
parentadf6c7bcbe989871b20c794b3f528aa348bc0c60 (diff)
downloademacs-f8a25d00ae45a3362b08a999026835fde85f6ef0.tar.gz
emacs-f8a25d00ae45a3362b08a999026835fde85f6ef0.zip
Make 'overlays_in' use only real EOB (bug#80242)
This restores the original behavior of 'overlays_in'. Changes in this behavior had been made for cases of narrowing, but this resulted in a regression with uses of 'remove-overlays'. * src/buffer.c (overlays_in): Change all occurrences of ZV to Z. * test/src/buffer-tests.el (test-overlays-in-2) (test-remove-overlays): Adjust expected results to accommodate changes in 'overlays_in'.
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 3d85d784f1c..1129d178c7b 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -3082,14 +3082,13 @@ overlays_in (ptrdiff_t beg, ptrdiff_t end, bool extend,
3082{ 3082{
3083 ptrdiff_t idx = 0; 3083 ptrdiff_t idx = 0;
3084 ptrdiff_t len = *len_ptr; 3084 ptrdiff_t len = *len_ptr;
3085 ptrdiff_t next = ZV; 3085 ptrdiff_t next = Z;
3086 Lisp_Object *vec = *vec_ptr; 3086 Lisp_Object *vec = *vec_ptr;
3087 struct itree_node *node; 3087 struct itree_node *node;
3088 3088
3089 /* Extend the search range if overlays beginning at ZV are 3089 /* Extend the search range if overlays beginning at Z are wanted. */
3090 wanted. */ 3090 ptrdiff_t search_end = Z;
3091 ptrdiff_t search_end = ZV; 3091 if (end >= Z && (empty || trailing))
3092 if (end >= ZV && (empty || trailing))
3093 ++search_end; 3092 ++search_end;
3094 3093
3095 ITREE_FOREACH (node, current_buffer->overlays, beg, search_end, 3094 ITREE_FOREACH (node, current_buffer->overlays, beg, search_end,
@@ -3103,7 +3102,7 @@ overlays_in (ptrdiff_t beg, ptrdiff_t end, bool extend,
3103 else if (node->begin == end) 3102 else if (node->begin == end)
3104 { 3103 {
3105 next = node->begin; 3104 next = node->begin;
3106 if ((! empty || end < ZV) && beg < end) 3105 if ((! empty || end < Z) && beg < end)
3107 break; 3106 break;
3108 if (empty && node->begin != node->end) 3107 if (empty && node->begin != node->end)
3109 continue; 3108 continue;
@@ -3125,7 +3124,7 @@ overlays_in (ptrdiff_t beg, ptrdiff_t end, bool extend,
3125 idx++; 3124 idx++;
3126 } 3125 }
3127 if (next_ptr) 3126 if (next_ptr)
3128 *next_ptr = next ? next : ZV; 3127 *next_ptr = next ? next : Z;
3129 3128
3130 return idx; 3129 return idx;
3131} 3130}