[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: delete-overlay causes recentering
From: |
Chong Yidong |
Subject: |
Re: delete-overlay causes recentering |
Date: |
Sat, 14 Apr 2007 21:44:23 -0400 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.97 (gnu/linux) |
address@hidden (Johan Bockgård) writes:
> Evaluate the code below. Then press f8, f9, f8, f9, ...
>
> (defvar ov nil)
>
> (defun foo ()
> (interactive)
> (set-window-start (selected-window) 834)
> (goto-char 1237)
> (setq ov (make-overlay 1237 1242))
> (overlay-put ov 'face 'highlight))
>
> (defun bar ()
> (interactive)
> (delete-overlay ov))
>
> (global-set-key [f8] 'foo)
> (global-set-key [f9] 'bar)
>
> (progn
> (switch-to-buffer "*foo*")
> (dotimes (n 30)
> (insert "Emacs is the extensible, customizable, "
> "self-documenting real-time display editor. "))
> (goto-char (point-min))
> (insert " "))
>
> delete-overlay causes a recentering. (Actually, so do mouse clicks in
> this case.)
The behavior arose from the following change:
2006-04-20 Kim F. Storm <address@hidden>
* xdisp.c (redisplay_window): Fix last change.
* xdisp.c (redisplay_window): If current window start is not at the
beginning of a line, select a new window start if buffer is modified
and window start is in the modified region, but the first change is
before window start.
*** emacs/src/xdisp.c 2006/04/13 01:21:48 1.1086
--- emacs/src/xdisp.c 2006/04/20 08:46:56 1.1088
***************
*** 12689,12696 ****
/* IT may overshoot PT if text at PT is invisible. */
else if (IT_CHARPOS (it) > PT && CHARPOS (startp) <= PT)
w->force_start = Qt;
-
-
}
/* Handle case where place to start displaying has been specified,
--- 12689,12694 ----
***************
*** 12860,12865 ****
--- 12858,12892 ----
|| (XFASTINT (w->last_modified) >= MODIFF
&& XFASTINT (w->last_overlay_modified) >= OVERLAY_MODIFF)))
{
+
+ /* If first window line is a continuation line, and window start
+ is inside the modified region, but the first change is before
+ current window start, we must select a new window start.*/
+ if (NILP (w->start_at_line_beg))
+ {
+ /* Make sure beg_unchanged and end_unchanged are up to date.
+ Do it only if buffer has really changed. This may or may
+ not have been done by try_window_id (see which) already. */
+ if (MODIFF > SAVE_MODIFF
+ /* This seems to happen sometimes after saving a buffer. */
+ || BEG_UNCHANGED + END_UNCHANGED > Z_BYTE)
+ {
+ if (GPT - BEG < BEG_UNCHANGED)
+ BEG_UNCHANGED = GPT - BEG;
+ if (Z - GPT < END_UNCHANGED)
+ END_UNCHANGED = Z - GPT;
+ }
+
+ if (CHARPOS (startp) > BEG + BEG_UNCHANGED
+ && CHARPOS (startp) <= Z - END_UNCHANGED)
+ {
+ /* There doesn't seems to be a simple way to find a new
+ window start that is near the old window start, so
+ we just recenter. */
+ goto recenter;
+ }
+ }
+
#if GLYPH_DEBUG
debug_method_add (w, "same window start");
#endif
- delete-overlay causes recentering (was: address@hidden: a bug in global-hl-line-mode]), Johan Bockgård, 2007/04/13
- Re: delete-overlay causes recentering, martin rudalics, 2007/04/14
- Re: delete-overlay causes recentering,
Chong Yidong <=
- Re: delete-overlay causes recentering, Chong Yidong, 2007/04/14
- Re: delete-overlay causes recentering, Chong Yidong, 2007/04/15
- Re: delete-overlay causes recentering, Kim F. Storm, 2007/04/15
- Re: delete-overlay causes recentering, Johan Bockgård, 2007/04/23
- Re: delete-overlay causes recentering, Chong Yidong, 2007/04/23
- Re: delete-overlay causes recentering, Chong Yidong, 2007/04/23
- Re: delete-overlay causes recentering, Stefan Monnier, 2007/04/23
- Re: delete-overlay causes recentering, Richard Stallman, 2007/04/23
- Re: delete-overlay causes recentering, Chong Yidong, 2007/04/23
- Re: delete-overlay causes recentering, Richard Stallman, 2007/04/25