src/textprop.c (get_char_property_and_overlay): Fix bug#58479
Correct `get-char-property` which failed to ignore empty overlays. * src/textprop.c (get_char_property_and_overlay): Make sure the overlay covers the character. * test/src/buffer-tests.el (buffer-tests--overlay-bug58479): New test. * src/buffer.h (buffer_has_overlays): Avoid `interval_tree_size`.
This commit is contained in:
parent
65a7b5a802
commit
b865053874
3 changed files with 11 additions and 2 deletions
|
@ -1275,7 +1275,7 @@ INLINE bool
|
|||
buffer_has_overlays (void)
|
||||
{
|
||||
return current_buffer->overlays
|
||||
&& (interval_tree_size (current_buffer->overlays) > 0);
|
||||
&& (current_buffer->overlays->root != ITREE_NULL);
|
||||
}
|
||||
|
||||
/* Functions for accessing a character or byte,
|
||||
|
|
|
@ -649,7 +649,8 @@ get_char_property_and_overlay (Lisp_Object position, register Lisp_Object prop,
|
|||
Lisp_Object tem = Foverlay_get (node->data, prop);
|
||||
struct sortvec *this;
|
||||
|
||||
if (NILP (tem) || (w && ! overlay_matches_window (w, node->data)))
|
||||
if (NILP (tem) || node->end < pos + 1
|
||||
|| (w && ! overlay_matches_window (w, node->data)))
|
||||
continue;
|
||||
|
||||
this = (result == items ? items + 1 : items);
|
||||
|
|
|
@ -1340,6 +1340,14 @@ with parameters from the *Messages* buffer modification."
|
|||
(overlay-put ov 'value i)))
|
||||
(should (eq 9 (get-char-property 1 'value)))))
|
||||
|
||||
(ert-deftest buffer-tests--overlay-bug58479 ()
|
||||
(with-temp-buffer
|
||||
(insert "ab")
|
||||
(let* ((pos (+ (point-min) 1))
|
||||
(ol (make-overlay pos pos)))
|
||||
(overlay-put ol 'my-prop 'set)
|
||||
(should (null (get-char-property pos 'my-prop))))))
|
||||
|
||||
|
||||
;; +==========================================================================+
|
||||
;; | Other
|
||||
|
|
Loading…
Add table
Reference in a new issue