Subject: bug#22637: 25.1.50; `mode-line` face `:height` incompatible with `scroll-conservatively 101`.

From: Eli Zaretskii <[email-masked]>
Date: Sun, 14 Feb 2016 08:05:58 +0200

> Date:  Sat, 13 Feb 2016 19:40:34 -0800
> From:  Keith David Bershatsky <[email-masked]>
> Cc:  [email-masked]
> 
> In addition to the fix that you implemented yesterday near the section of "optimization 3", another similar fix would be needed near the following "recenter" section that affects cursor visibility when using isearch where sometimes point is below the bottom of the screen and remains there subsequent to redisplay.  I have not yet been able to figure out how to use `cursor_row_fully_visible_p`, so I used something a little easier for me to understand that basically tests the same thing (I think).
> 
> If I can come up with a small test that demonstrates the problem when searching, I'll send over an example.  The following code, however, does seem to fix the problem in all of my tests.

Please do come up with a test case.  I don't want to make any change
that doesn't have a test which fails before and succeeds after the
change.  Having such test cases allows us to make sure later changes
don't reintroduce the same bug.

>   /* Added a check/fix for a problem similar/same as bug #22637.  */
>   if (1 == try_window (window, it.current.pos, TRY_WINDOW_CHECK_MARGINS))
>     {
>       bool fully_p = false;
>       EMACS_INT posint = PT;
>       struct buffer *buf;
>       int x, y, rtop, rbot, rowh, vpos;
>       buf = XBUFFER (w->contents);
>       if ((posint >= CHARPOS (startp) && posint <= BUF_ZV (buf))
>           && CHARPOS (startp) >= BUF_BEGV (buf)
>           && CHARPOS (startp) <= BUF_ZV (buf)
>           && pos_visible_p (w, posint, &x, &y, &rtop, &rbot, &rowh, &vpos))
>         fully_p = !rtop && !rbot;
>       if (!fully_p)
>         {
> #ifdef GLYPH_DEBUG
>           debug_method_add (w, "!fully_p -- goto try_to_scroll");
> #endif
>           goto try_to_scroll;
>         }
>         else
>           {
> #ifdef GLYPH_DEBUG
>             debug_method_add (w, "fully_p -- goto done");
> #endif
>             goto done;
>           }

I don't think this is correct.  try_window is called in many more
places in the display engine, so if this problem is due to what it
does, the fix should be inside try_window, not in its callers.

But I could be wrong -- I need to see the problem to be sure.

Thanks.