bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#14836: Line scrolling inconsistent with global-hl-line-mode and some


From: Eli Zaretskii
Subject: bug#14836: Line scrolling inconsistent with global-hl-line-mode and some font settings
Date: Wed, 10 Jul 2013 19:35:35 +0300

> From: Dima Kogan <address@hidden>
> Date: Wed, 10 Jul 2013 00:48:43 -0700
> 
> - Screen scrolls by 1 line, revealing one new previously-cut-off line at
>   the bottom. The point does NOT move, meaning (point) returns the same
>   value before and after the C-n. The visual indication of the point
>   does move, since it scrolls together with the text.
> 
> - The point moves to this newly-visible line. Nothing scrolls
> 
> 
> I looked at some pertinent values when this happens to try to shed some
> light on the behavior:
> 
>  (defun doreport ()
>    (let ((report (format (concat "(point): %s\n"
>                                  "(pos-visible-in-window-p t nil t): %s\n"
>                                  "(posn-at-point): %s\n"
>                                  "(default-font-height): %s\n")
>                                  (point) (pos-visible-in-window-p t nil t)
>                                  (posn-at-point) (default-font-height))))
>      (with-current-buffer "*scratch*"
>        (insert report))))
> 
> When the point is sitting on a line such that the next C-n would scroll
> by one line while leaving the point stationary (doreport) says:
> 
>  (point): 112
>  (pos-visible-in-window-p t nil t): (0 902 0 15 7 41)
>  (posn-at-point): (#<window 0x1138430 on dat> 112 (0 . 880) 0 nil 112 (0 . 
> 40) nil (0 . 0) (15 . 22))
>  (default-font-height): 22
> 
> Immediately after such a scroll-only motion (and right before C-n would
> simply move the point by one line without scrolling) (doreport) says:
> 
>  (point): 112
>  (pos-visible-in-window-p t nil t): (0 902 0 15 7 41)
>  (posn-at-point): (#<window 0x1138430 on dat> 112 (0 . 858) 0 nil 112 (0 . 
> 39) nil (0 . 0) (15 . 22))
>  (default-font-height): 22
> 
> I can reproduce this reliably, so please ask if more probes would be
> useful.

Please apply the patch below, run the recipe, and post here the
results you get in the *Messages* buffer.

=== modified file 'lisp/simple.el'
--- lisp/simple.el      2013-07-10 16:18:17 +0000
+++ lisp/simple.el      2013-07-10 16:31:59 +0000
@@ -4821,6 +4821,9 @@ The value is a floating-point number."
                     (< rowh dlh))
                (setq last-line (min (- wslines scroll-margin) vpos))
              (setq last-line (min (- wslines scroll-margin 1) (1- vpos)))))
+       (message "vs %s dlh %s this %s rowh %s rbot %s py %s vpos %s last %s"
+                (window-vscroll nil t)
+                dlh this-height rowh rbot py vpos last-line)
        (cond
         ;; If last line of window is fully visible, and vscrolling
         ;; more would make this line invisible, move forward.
@@ -4828,6 +4831,7 @@ The value is a floating-point number."
                   (null this-height)
                   (<= this-height dlh))
               (or (null rbot) (= rbot 0)))
+         (message "1")
          nil)
         ;; If cursor is not in the bottom scroll margin, and the
         ;; current line is is not too tall, move forward.
@@ -4835,12 +4839,14 @@ The value is a floating-point number."
               vpos
               (> vpos 0)
               (< py last-line))
+         (message "2")
          nil)
         ;; When already vscrolled, we vscroll some more if we can,
         ;; or clear vscroll and move forward at end of tall image.
         ((> vs 0)
          (when (or (and rbot (> rbot 0))
                    (and this-height (> this-height dlh)))
+           (message "3")
            (set-window-vscroll nil (+ vs dlh) t)))
         ;; If cursor just entered the bottom scroll margin, move forward,
         ;; but also optionally vscroll one line so redisplay won't recenter.
@@ -4859,14 +4865,17 @@ The value is a floating-point number."
          ;; discrepancies between that and DLH.
          (if (and rowh rbot (>= (- (+ rowh rbot) dlh) 1))
              (set-window-vscroll nil dlh t))
+         (message "4, vs %s" (window-vscroll nil t))
          (line-move-1 arg noerror to-end)
          t)
         ;; If there are lines above the last line, scroll-up one line.
         ((and vpos (> vpos 0))
+         (message "5")
          (scroll-up 1)
          t)
         ;; Finally, start vscroll.
         (t
+         (message "6")
          (set-window-vscroll nil dlh t)))))))
 
 






reply via email to

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