emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Display problems with `before-string' in overlay


From: Richard Stallman
Subject: Display problems with `before-string' in overlay
Date: Sun, 15 Apr 2007 09:59:21 -0400

You proposed a change in the code at 2010 in keyboard.c.
(I've copied it below.)  I don't see why it is correct,
so here are some questions.

    !     && (OVERLAYP (overlay)
    !         ? (beg = OVERLAY_POSITION (OVERLAY_START (overlay)),
    !            end = OVERLAY_POSITION (OVERLAY_END (overlay)),
    !            beg <= PT)

How can it ever happen that BEG <= PT is false?
If that were false, the overlay would not cover PT,
so it should not have been returned in the first place, right?

Anyway, your change is to replace 

             (beg < PT /* && end > PT   <- It's always the case.  */
              || (beg <= PT && STRINGP (val) && SCHARS (val) == 0))

with a condition that is always true.  Could you please explain the
motive for that change?  Why is it correct to adjust point when it
starts out at the beginning of an overlay with a `display' property?

Also, why is the condition

              || (beg <= PT && STRINGP (val) && SCHARS (val) == 0)

used at all?  What usage case is that meant to cover, and what is the
right behavior for that case?  Even if we don't change the code here
now, we need to put in a comment about that.



*** emacs/src/keyboard.c.~1.899.~       2007-04-04 13:05:31.000000000 -0400
--- emacs/src/keyboard.c        2007-04-13 14:04:15.000000000 -0400
***************
*** 2010,2021 ****
          && !NILP (val = get_char_property_and_overlay
                              (make_number (PT), Qdisplay, Qnil, &overlay))
          && display_prop_intangible_p (val)
!         && (!OVERLAYP (overlay)
!             ? get_property_and_range (PT, Qdisplay, &val, &beg, &end, Qnil)
!             : (beg = OVERLAY_POSITION (OVERLAY_START (overlay)),
!                end = OVERLAY_POSITION (OVERLAY_END (overlay))))
!         && (beg < PT /* && end > PT   <- It's always the case.  */
!             || (beg <= PT && STRINGP (val) && SCHARS (val) == 0)))
        {
          xassert (end > PT);
          SET_PT (PT < last_pt
--- 2010,2022 ----
          && !NILP (val = get_char_property_and_overlay
                              (make_number (PT), Qdisplay, Qnil, &overlay))
          && display_prop_intangible_p (val)
!         && (OVERLAYP (overlay)
!             ? (beg = OVERLAY_POSITION (OVERLAY_START (overlay)),
!                end = OVERLAY_POSITION (OVERLAY_END (overlay)),
!                beg <= PT)
!             : (get_property_and_range (PT, Qdisplay, &val, &beg, &end, Qnil),
!                (beg < PT
!                 || (beg <= PT && STRINGP (val) && SCHARS (val) == 0)))))
        {
          xassert (end > PT);
          SET_PT (PT < last_pt




reply via email to

[Prev in Thread] Current Thread [Next in Thread]