[Top][All Lists]

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

scroll-preserve-screen-position and tall lines

From: Ralf Angeli
Subject: scroll-preserve-screen-position and tall lines
Date: Mon, 04 Jul 2005 18:32:59 +0200
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

When `scroll-preserve-screen-position' is set to `always' Emacs
doesn't manage to keep the vertical position of point relative to
window boundaries if tall lines are involved.  Here is a testcase:

  (setq scroll-preserve-screen-position 'always)
  (pop-to-buffer (get-buffer-create "*test*"))
  (dotimes (i 50) (insert (concat (number-to-string i) "\n")))
  (insert "TALL\n")
  (put-text-property (line-beginning-position 0) (line-end-position 0)
                     'face '(:height 2.0 :inherit variable-pitch))
  (dotimes (i 50) (insert (concat (number-to-string (+ i 50)) "\n")))
  (search-backward "TALL"))

After executing it, scroll the buffer by one line with `C-u 1 C-v'.
Notice that point does not keep its vertical position but moves
upwards together with the string "TALL".  (`scroll-down' does not seem
to be affected.)

In the functionality of `scroll-preserve-screen-position' is
implemented in Elisp, it is working as intended.  You can try it by
executing the following function while having point on the "TALL"
string in the *test* buffer generated from the code above.

(defun scroll-up-test ()
  (setq scroll-preserve-screen-position nil)
  (let ((orig-window-line (count-screen-lines (save-excursion
                                                (move-to-window-line 0)
    (scroll-up 1)
    (move-to-window-line orig-window-line)))

In GNU Emacs (i686-pc-linux-gnu, GTK+ Version 2.6.8)
 of 2005-07-04 on neutrino
X server distributor `The XFree86 Project, Inc', version 11.0.40300001
configured using `configure '--with-gtk''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US
  locale-coding-system: iso-latin-1
  default-enable-multibyte-characters: t

Major mode: Fundamental

Minor modes in effect:
  desktop-save-mode: t
  display-time-mode: t
  iswitchb-mode: t
  show-paren-mode: t
  encoded-kbd-mode: t
  mouse-wheel-mode: t
  auto-compression-mode: t
  menu-bar-mode: t
  global-font-lock-mode: t
  blink-cursor-mode: t
  unify-8859-on-encoding-mode: t
  utf-translate-cjk-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t
  next-error-follow-minor-mode:  Fol

Recent input:
C-n C-y C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p 
C-b C-x C-e C-u 1 C-v C-x o C-n C-n C-n C-n C-n C-n 
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-b C-x C-e 
C-x o M-x s c r o l l - u p - t e <tab> <return> M-x 
M-p <return> M-x M-p <return> C-p C-p C-p C-p M-x M-p 
<return> M-x M-p <return> M-x r e p o r t - e m <tab> 

Recent messages:
Loading edmacro...done
No desktop file.
Loading jit-lock...done
For information about the GNU Project and its goals, type C-h C-p.
Loading cl-seq...done
Mark set
Loading cl-macs...done
Loading emacsbug...done

reply via email to

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