Mercurial > emacs
comparison lisp/simple.el @ 3642:e14773d3f849
* simple.el (hscroll-point-visible): Work as documented in the
docstring for hscroll-step.
author | Jim Blandy <jimb@redhat.com> |
---|---|
date | Fri, 11 Jun 1993 09:45:20 +0000 |
parents | 58add805382e |
children | d42ad851d210 |
comparison
equal
deleted
inserted
replaced
3641:a846352be1a0 | 3642:e14773d3f849 |
---|---|
1475 If that fails to bring point back on frame, point is centered instead. | 1475 If that fails to bring point back on frame, point is centered instead. |
1476 If this is zero, point is always centered after it moves off frame.") | 1476 If this is zero, point is always centered after it moves off frame.") |
1477 | 1477 |
1478 (defun hscroll-point-visible () | 1478 (defun hscroll-point-visible () |
1479 "Scrolls the window horizontally to make point visible." | 1479 "Scrolls the window horizontally to make point visible." |
1480 (let* ((min (window-hscroll)) | 1480 (let* ((here (current-column)) |
1481 (max (- (+ min (window-width)) 2)) | 1481 (left (window-hscroll)) |
1482 (here (current-column)) | 1482 (right (- (+ left (window-width)) 3))) |
1483 (delta (if (zerop hscroll-step) (/ (window-width) 2) hscroll-step)) | 1483 (cond |
1484 ) | 1484 ;; Should we recenter? |
1485 (if (< here min) | 1485 ((or (< here (- left hscroll-step)) |
1486 (scroll-right (max 0 (+ (- min here) delta))) | 1486 (> here (+ right hscroll-step))) |
1487 (if (>= here max) | 1487 (set-window-hscroll |
1488 (scroll-left (- (- here min) delta)) | 1488 (selected-window) |
1489 )))) | 1489 ;; Recenter, but don't show too much white space off the end of |
1490 ;; the line. | |
1491 (max 0 | |
1492 (min (- (save-excursion (end-of-line) (current-column)) | |
1493 (window-width) | |
1494 -5) | |
1495 (- here (/ (window-width) 2)))))) | |
1496 ;; Should we scroll left? | |
1497 ((> here right) | |
1498 (scroll-left hscroll-step)) | |
1499 ;; Or right? | |
1500 ((< here left) | |
1501 (scroll-right hscroll-step))))) | |
1490 | 1502 |
1491 ;; rms: (1) The definitions of arrow keys should not simply restate | 1503 ;; rms: (1) The definitions of arrow keys should not simply restate |
1492 ;; what keys they are. The arrow keys should run the ordinary commands. | 1504 ;; what keys they are. The arrow keys should run the ordinary commands. |
1493 ;; (2) The arrow keys are just one of many common ways of moving point | 1505 ;; (2) The arrow keys are just one of many common ways of moving point |
1494 ;; within a line. Real horizontal autoscrolling would be a good feature, | 1506 ;; within a line. Real horizontal autoscrolling would be a good feature, |