Subject: RE: bug#15839: 24.3.50; `isearch-allow-scroll': be able to scroll point off screen temporarily

From: Drew Adams <[email-masked]>
Date: Mon, 11 Nov 2013 11:08:43 -0800 (PST)

> The more important bugs are these:
> 
> a. Scrolling backwards is not limited currently (it should be
> unlimited only when the option value is `unlimited', i.e., after the
> requested enhancement).
> 
> b. Forward scrolling after backward scrolling throws everything off
> currently: the highlighting that should apply only to the current
> search hit (face `isearch') is applied to the entire window
> (buffer?).
> 
> Bug (b) is the most serious, but I'm guessing that (b) and (a) are
> due to the same code problem.

(BTW, (b) is the case symmetrically: if you start searching backward
and then scroll up (in the search direction) and then scroll down, you
get the same extension of `isearch-overlay' across the whole window.)

I've tried to look into (b) a bit.  I tried adding some code that calls
`isearch-dehighlight' during scrolling and `isearch-highlight' when
finished scrolling, just to see.  I added calls to `message' to print
the value of `isearch-overlay' at various points.

It turns out that (because of the call I added to dehighlight) the
overlay is properly deleted (overlay in no buffer) but it is still
showing.  (And it extends across the window.)  I tried adding
(redisplay t), but that had no effect.

So this is apparently a case where a deleted overlay is showing.
What's a way to prevent this phenomenon?