Improve UPDATE-BUFFER-CURSOR's means of getting a line into view
This commit is contained in:
parent
5ad61839c2
commit
34f705aef8
1 changed files with 14 additions and 11 deletions
|
@ -422,17 +422,8 @@ Additionally ensures correct line numbers on the way, as a bonus."
|
|||
:do (ensure-correct-line-number line))
|
||||
(let ((line-number (view-line-number (buffer-view buffer)
|
||||
(cursor-line (cursor buffer)))))
|
||||
;; the ugly (of many, one)
|
||||
(when (null line-number) ; line is off-screen
|
||||
(if (and (not (null (bottom-line (buffer-view buffer))))
|
||||
(eql (next-line (bottom-line (buffer-view buffer)))
|
||||
(cursor-line (cursor buffer))))
|
||||
(setf (top-line (buffer-view buffer))
|
||||
(next-line (top-line (buffer-view buffer)))
|
||||
(bottom-line (buffer-view buffer)) nil)
|
||||
(setf (top-line (buffer-view buffer)) (cursor-line (cursor buffer))
|
||||
(bottom-line (buffer-view buffer)) nil))
|
||||
(redisplay-view (buffer-view buffer))
|
||||
(when (null line-number)
|
||||
(get-line-into-view (cursor-line (cursor buffer)) (buffer-view buffer))
|
||||
(setf line-number (view-line-number (buffer-view buffer)
|
||||
(cursor-line (cursor buffer)))))
|
||||
(move-cursor line-number (cursor-column (cursor buffer)))))
|
||||
|
@ -554,6 +545,18 @@ Additionally ensures correct line numbers on the way, as a bonus."
|
|||
(redisplay-line (top-line view))
|
||||
(redisplay-status-line :completely-p t))
|
||||
|
||||
(defmethod get-line-into-view ((line line) (view buffer-view))
|
||||
;; Assuming it's not already.
|
||||
(update-view-bottom view)
|
||||
(cond ((eql line (prev-line (top-line view)))
|
||||
(scroll-view-up view))
|
||||
((eql line (next-line (bottom-line view)))
|
||||
(scroll-view-down view))
|
||||
(t
|
||||
(setf (top-line view) line)
|
||||
(redisplay-view view)))
|
||||
(redisplay-status-line :completely-p nil))
|
||||
|
||||
(defmethod current-view ((obj editor))
|
||||
(buffer-view (current-buffer obj)))
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue