emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Setting cursor-type does not trigger redisplay of cursor


From: Kim F. Storm
Subject: Re: Setting cursor-type does not trigger redisplay of cursor
Date: Wed, 09 Nov 2005 17:08:49 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

"Richard M. Stallman" <address@hidden> writes:

>     > Right now, what is it that you need to do to make Emacs really
>     > display the new cursor type?
>
>     In Emacs 21, I need to call (sit-for 0) to force a redisplay.  In
>     Emacs 22 CVS, I am told, that doesn't work.
>
> That is clearly a bug.
>
> It seems to me that it should not be terribly hard to make redisplay
> record the last cursor-type used for redisplay in a given frame, and
> DTRT when it has changed.  So why do anything less convenient?
>
> Would someone like to implement that, please?

I looked at the bug, and the reason why it works for right-left and
down movement, but not for up movement (sometimes) is the call to
sit-for in line-move:

          (when (line-move-1 arg noerror to-end)
            (when (not forward)
              ;; Update display before calling pos-visible-in-window-p,
              ;; because it depends on window-start being up-to-date.
              (sit-for 0)


The reason for this update is to handle scrolling in large images.
(This is something which need to be improved after the release).

The problem is that the sit-for runs redisplay before the
post-command-hook, so the cursor type is displayed based on the
previous buffer position rather than the current position when moving
the cursor upwards.

The simple "fix" is to explicitly call force-window-update when
changing the cursor type in the post-command-hook.  IMO, that
work-around is ok for 22.1:

  (defun set-cursor-adaptive ()
    (let ((ocursor cursor-type))
      (setq cursor-type (if (eq (char-after (point)) ?\n) '(bar . 5) t))
      (if (not (equal ocursor cursor-type))
        (force-window-update (current-buffer)))))


-- 
Kim F. Storm <address@hidden> http://www.cua.dk





reply via email to

[Prev in Thread] Current Thread [Next in Thread]