1
0
Fork 0

- fixed 'line-oriented-window:row-move' must return always a number

(0), not nil, when no movement occurs;

- fixed vertical scrolling boundaries of messages window.
This commit is contained in:
cage 2020-09-06 11:18:49 +02:00
parent 5721bb411c
commit 6135cc5c02
2 changed files with 36 additions and 17 deletions

View File

@ -221,18 +221,19 @@ actual of rows moved. This can be different from `amount' if moving
this exact quantity wold go beyond the length or fows or zero."
(with-accessors ((rows rows)
(row-selected-index row-selected-index)) object
(when (/= 0 amount)
(let* ((desired-amount (+ amount row-selected-index))
(actual-amount (if (< amount 0)
(max (- desired-amount
row-selected-index)
(- row-selected-index))
(- (min desired-amount
(1- (length rows)))
row-selected-index))))
(select-row object (+ row-selected-index
actual-amount))
actual-amount))))
(if (/= 0 amount)
(let* ((desired-amount (+ amount row-selected-index))
(actual-amount (if (< amount 0)
(max (- desired-amount
row-selected-index)
(- row-selected-index))
(- (min desired-amount
(1- (length rows)))
row-selected-index))))
(select-row object (+ row-selected-index
actual-amount))
actual-amount)
0)))
(defclass simple-line-navigation-window (wrapper-window row-oriented-widget border-window)
((selected-line-bg

View File

@ -166,9 +166,26 @@
(when prepare-for-rendering
(prepare-for-rendering object :jump-to-first-row jump-to-first-row))))
(defun offset-to-move-end (win)
(with-accessors ((rows rows)
(row-selected-index row-selected-index)) win
(let ((win-height (win-height-no-border win)))
(- (- (length rows)
(- win-height 1))
row-selected-index))))
(defun scroll-end-reached-p (win)
(with-accessors ((rows rows)
(row-selected-index row-selected-index)) win
(let* ((win-height (win-height-no-border win))
(rows-left (- (length rows) row-selected-index)))
(< rows-left
win-height))))
(defmethod scroll-down ((object message-window) &optional (amount 1))
(when (/= (row-move object amount)
0)
(when (not (or (scroll-end-reached-p object)
(= (row-move object amount)
0)))
(draw object)))
(defmethod scroll-up ((object message-window) &optional (amount 1))
@ -179,9 +196,10 @@
(defmethod scroll-end ((object message-window))
(with-accessors ((rows rows)
(row-selected-index row-selected-index)) object
(when (/= (row-move object (- (length rows) row-selected-index))
0)
(draw object))))
(let ((offset (offset-to-move-end object)))
(when (/= (row-move object offset)
0)
(draw object)))))
(defmethod scroll-begin ((object message-window))
(with-accessors ((rows rows)