mirror of https://codeberg.org/cage/tinmop/
- 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:
parent
5721bb411c
commit
6135cc5c02
|
@ -221,7 +221,7 @@ 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)
|
||||
(if (/= 0 amount)
|
||||
(let* ((desired-amount (+ amount row-selected-index))
|
||||
(actual-amount (if (< amount 0)
|
||||
(max (- desired-amount
|
||||
|
@ -232,7 +232,8 @@ this exact quantity wold go beyond the length or fows or zero."
|
|||
row-selected-index))))
|
||||
(select-row object (+ row-selected-index
|
||||
actual-amount))
|
||||
actual-amount))))
|
||||
actual-amount)
|
||||
0)))
|
||||
|
||||
(defclass simple-line-navigation-window (wrapper-window row-oriented-widget border-window)
|
||||
((selected-line-bg
|
||||
|
|
|
@ -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))
|
||||
(let ((offset (offset-to-move-end object)))
|
||||
(when (/= (row-move object offset)
|
||||
0)
|
||||
(draw object))))
|
||||
(draw object)))))
|
||||
|
||||
(defmethod scroll-begin ((object message-window))
|
||||
(with-accessors ((rows rows)
|
||||
|
|
Loading…
Reference in New Issue