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`.
buffer_has_overlays (void)
{
return current_buffer->overlays
- && (interval_tree_size (current_buffer->overlays) > 0);
+ && (current_buffer->overlays->root != ITREE_NULL);
}
\f
/* Functions for accessing a character or byte,
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);
(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