At 3:39 PM +0200 5/8/00, Jan Vroonhof wrote:
Mike Alexander <mta(a)arbortext.com> writes:
>  The patch below avoids this problem.  It occurs if the height of a
>  window is so small that not even one line can be formatted in it.  In
>  this case the line cache will always be empty and
>  point-in-line-start-cache will return -1 which was causing vmotion-1
>  to assert.  I looked at the various callers of vmotion-1 and it
>  appears that it is reasonable to just have it return the input point
>  unchanged in this case, so that's what I did.  If this is not the
>  right thing to do, I'd be happy to hear alternative suggestions.
I have made similar changes to callers of point_in_line_start_cache,
so the work around is along the right lines.
However
1. Just returning point sort-of seems wrong. vmotion is intended to
    scroll to it seems a nice thing to at least move to the next line. 
There is no next line, that's the problem.
2. vmotion calls pilsc with a min_past argument so there should have
    been lines layed out even if non can be completely visible.
    It would be nice if you could put a break point on the assert and
    call point_in_line_start_cache with the same arguments again and
    step though it with the debugger. 
I did that.  It doesn't lay out any lines because the height of the 
window is less than the height of one line.  I don't know enough 
about the redisplay code to know if this is supposed to be impossible 
or if it is normal but the redisplay code isn't handling it right. 
Unfortunately I don't have time to learn how the redisplay code works 
well enough to debug this.  The change I made was intended to be a 
defensive change against any problems such as this.  There may be a 
deeper problem that needs fixing, but I don't think my change will 
hurt anything (except perhaps hide the deeper problem).  If this 
bothers people it would be possible to leave the assert in the debug 
build and take it out in the optimized build.  For that matter, I 
don't really care if it is vetoed, but if so someone should fix the 
real problem (and I'm probably not the person to do that).
I think the reason this stuff is hard is because normally such small
windows don't exist very long because of window-min-height 
Right, I can't recall what I did recently to provoke this but it 
happened while I was trying to debug the problem with interrupting 
sub-processes.  I needed to do something to get around the problem so 
I could continue to work on the real problem I was trying to find. 
I've also seen this assert fire in the past when starting up ediff.
        Mike