[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Scrolling to an item
- To: info-macl@cambridge.apple.com
- Subject: Scrolling to an item
- From: Gat <Gat@ai.jpl.nasa.gov>
- Date: 14 Nov 90 18:15:38
Subject: Scrolling to an item
Here's a bit of code which might be of use to the person asking about scrolling
a fred window to insure that a prticular item is visible. It scrolls a fred
window so that the cursor is visible.
(defobfun (scroll-to-cursor *fred-window*) ()
(let* ((window-height (point-v (window-size)))
(font-size
(multiple-value-bind (x y) (font-info (window-font)) (+ x y)))
(lines (truncate (/ window-height font-size)))
(start-pos
(buffer-line-end (window-buffer) (window-cursor-mark) (- 2 lines))))
(set-mark (window-start-mark) start-pos)
(window-update)
(- lines 2)))
Erann Gat
gat@robotics.jpl.nasa.gov