From: Chong Yidong <cyd@stupidchicken.com>
To: Kim F. Storm <storm@cua.dk>
Cc: emacs-devel@gnu.org
Subject: Re: delete-overlay causes recentering
Date: Sat, 14 Apr 2007 21:44:23 -0400 [thread overview]
Message-ID: <87fy72v2bs.fsf@stupidchicken.com> (raw)
In-Reply-To: <yoijd528o1dy.fsf_-_@gamma02.me.chalmers.se> ("Johan Bockgård"'s message of "Fri\, 13 Apr 2007 15\:22\:01 +0200")
bojohan+news@dd.chalmers.se (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 <storm@cua.dk>
* 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
next prev parent reply other threads:[~2007-04-15 1:44 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-14 10:18 [alinsoar@voila.fr: a bug in global-hl-line-mode] A Soare
2007-03-14 12:52 ` Kim F. Storm
2007-04-13 13:22 ` delete-overlay causes recentering (was: [alinsoar@voila.fr: a bug in global-hl-line-mode]) Johan Bockgård
2007-04-14 9:13 ` delete-overlay causes recentering martin rudalics
2007-04-14 11:45 ` Johan Bockgård
2007-04-15 1:44 ` Chong Yidong [this message]
2007-04-15 1:50 ` Chong Yidong
2007-04-15 19:06 ` Chong Yidong
2007-04-15 20:13 ` Kim F. Storm
2007-04-23 13:57 ` Johan Bockgård
2007-04-23 14:11 ` Chong Yidong
2007-04-23 14:17 ` Chong Yidong
2007-04-23 15:42 ` Stefan Monnier
2007-04-23 23:07 ` Richard Stallman
2007-04-24 1:35 ` Chong Yidong
2007-04-25 14:51 ` Richard Stallman
2007-04-27 19:03 ` Chong Yidong
2007-04-28 4:07 ` Richard Stallman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87fy72v2bs.fsf@stupidchicken.com \
--to=cyd@stupidchicken.com \
--cc=emacs-devel@gnu.org \
--cc=storm@cua.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.