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

Scrolling to an item

   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)))
          (multiple-value-bind (x y) (font-info (window-font)) (+ x y)))
         (lines (truncate (/ window-height font-size)))
          (buffer-line-end (window-buffer) (window-cursor-mark) (- 2 lines))))
    (set-mark (window-start-mark) start-pos)
    (- lines 2)))

Erann Gat