v0.7.2: pads — Page Up/Down scroll by 10 lines (was 5) — TDD
Page Up/Down now scroll by 10 message lines per page (was 5). Updated comments. Pads: PageUp tests scroll exceeds 5; PageDown clamps to zero. Uses :ppage/:npage keywords in tests. - channel-tui-main: PageUp/Down+10, 2 tests - TUI Main: 104/104
This commit is contained in:
@@ -596,14 +596,14 @@ Event handlers + daemon I/O + main loop.
|
||||
(reverse (coerce (nth (st :input-hpos) h) 'list))
|
||||
nil))
|
||||
(setf (st :dirty) (list nil nil t)))))
|
||||
;; PageUp
|
||||
;; PageUp — scroll back by page (10 lines)
|
||||
((or (eq ch :ppage) (eql ch 339))
|
||||
(let ((max-offset (max 0 (- (length (st :messages)) 1))))
|
||||
(setf (st :scroll-offset) (min max-offset (+ (st :scroll-offset) 5))))
|
||||
(setf (st :scroll-offset) (min max-offset (+ (st :scroll-offset) 10))))
|
||||
(setf (st :dirty) (list nil t nil)))
|
||||
;; PageDown
|
||||
;; PageDown — scroll forward by page
|
||||
((or (eq ch :npage) (eql ch 338))
|
||||
(setf (st :scroll-offset) (max 0 (- (st :scroll-offset) 5)))
|
||||
(setf (st :scroll-offset) (max 0 (- (st :scroll-offset) 10)))
|
||||
(setf (st :dirty) (list nil t nil)))
|
||||
;; Printable
|
||||
(t
|
||||
@@ -1351,4 +1351,20 @@ Event handlers + daemon I/O + main loop.
|
||||
(on-key 13)
|
||||
(let ((msgs (st :messages)))
|
||||
(fiveam:is (some (lambda (m) (search ".env" (getf m :content))) msgs))))
|
||||
|
||||
(fiveam:test test-pads-page-up
|
||||
"Contract v0.7.2: PageUp scrolls by page size (> 5 lines)."
|
||||
(init-state)
|
||||
(dotimes (i 30) (add-msg :system (format nil "msg ~d" i)))
|
||||
(setf (st :scroll-offset) 0)
|
||||
(on-key :ppage)
|
||||
(fiveam:is (> (st :scroll-offset) 5) "Should scroll by more than 5 lines"))
|
||||
|
||||
(fiveam:test test-pads-page-down-clamp
|
||||
"Contract v0.7.2: PageDown clamps to 0."
|
||||
(init-state)
|
||||
(dotimes (i 5) (add-msg :system (format nil "msg ~d" i)))
|
||||
(setf (st :scroll-offset) 3)
|
||||
(on-key :npage)
|
||||
(fiveam:is (= 0 (st :scroll-offset))))
|
||||
#+end_src
|
||||
|
||||
Reference in New Issue
Block a user