return i < n;
}
+/* Return the value of the 'display-line-numbers-disable' property at
+ EOB, if there's an overlay at ZV with a non-nil value of that property. */
+Lisp_Object
+disable_line_numbers_overlay_at_eob (void)
+{
+ ptrdiff_t n, i, size;
+ Lisp_Object *v, tem = Qnil;
+ Lisp_Object vbuf[10];
+ USE_SAFE_ALLOCA;
+
+ size = ARRAYELTS (vbuf);
+ v = vbuf;
+ n = overlays_in (ZV, ZV, 0, &v, &size, NULL, NULL);
+ if (n > size)
+ {
+ SAFE_NALLOCA (v, 1, n);
+ overlays_in (ZV, ZV, 0, &v, &n, NULL, NULL);
+ }
+
+ for (i = 0; i < n; ++i)
+ if ((tem = Foverlay_get (v[i], Qdisplay_line_numbers_disable),
+ !NILP (tem)))
+ break;
+
+ SAFE_FREE ();
+ return tem;
+}
\f
/* Fast function to just test if we're at an overlay boundary. */
/* Defined in buffer.c. */
extern bool mouse_face_overlay_overlaps (Lisp_Object);
+extern Lisp_Object disable_line_numbers_overlay_at_eob (void);
extern _Noreturn void nsberror (Lisp_Object);
extern void adjust_overlays_for_insert (ptrdiff_t, ptrdiff_t);
extern void adjust_overlays_for_delete (ptrdiff_t, ptrdiff_t);
#endif
/* If the character at current position has a non-nil special
- property, disable line numbers for this row. */
- Lisp_Object val = Fget_char_property (make_number (IT_CHARPOS (*it)),
- Qdisplay_line_numbers_disable,
- it->window);
+ property, disable line numbers for this row. For ZV, we need to
+ use a special algorithm that only supports empty overlays at that
+ point, because get-char-property always returns nil for ZV. */
+ Lisp_Object val = Qnil;
+ if (IT_CHARPOS (*it) >= ZV)
+ val = disable_line_numbers_overlay_at_eob ();
+ else
+ val = Fget_char_property (make_number (IT_CHARPOS (*it)),
+ Qdisplay_line_numbers_disable, it->window);
return NILP (val) ? true : false;
}