Fix TUI scroll: bind Ctrl/Alt-arrows (Shift+Arrow is stripped)
ober
27705138a009ee34c387bb2be26d08f21a647fd7
--- a/src/jcode/ui/tui.ss +++ b/src/jcode/ui/tui.ss @@ -425,19 +425,22 @@ (max 0 (- (app-state-scroll-offset state) (quotient (msg-area-height state) 2)))) (app-state-dirty?-set! state #t)) - ;; Global: Shift-Up / Shift-Down full-page scroll. An arrow-key + ;; Global: Ctrl/Alt-Up / Ctrl/Alt-Down full-page scroll. An arrow-key ;; alternative to Page-up/down for keyboards that remap the Page keys - ;; (e.g. Kinesis). Plain Up/Down (no Shift) fall through to the input - ;; field below. Jumps a full message-area height per press. + ;; (e.g. Kinesis). NOTE: Shift+Arrow is NOT usable — most terminals/tmux + ;; strip it to a bare arrow (^[[A), indistinguishable from plain Up. But + ;; Ctrl+Arrow (^[[1;5A/B) and Alt+Arrow (^[[1;3A/B) survive, so we bind + ;; both. Plain Up/Down (no mod) still fall through to the input field + ;; below. Jumps a full message-area height per press. ((and (= key TB_KEY_ARROW_UP) - (not (zero? (bitwise-and mod TB_MOD_SHIFT)))) - (tui-log " -> shift-up page scroll") + (not (zero? (bitwise-and mod (bitwise-ior TB_MOD_CTRL TB_MOD_ALT))))) + (tui-log " -> ctrl/alt-up page scroll") (app-state-scroll-offset-set! state (+ (app-state-scroll-offset state) (msg-area-height state))) (app-state-dirty?-set! state #t)) ((and (= key TB_KEY_ARROW_DOWN) - (not (zero? (bitwise-and mod TB_MOD_SHIFT)))) - (tui-log " -> shift-down page scroll") + (not (zero? (bitwise-and mod (bitwise-ior TB_MOD_CTRL TB_MOD_ALT))))) + (tui-log " -> ctrl/alt-down page scroll") (app-state-scroll-offset-set! state (max 0 (- (app-state-scroll-offset state) (msg-area-height state)))) (app-state-dirty?-set! state #t)) @@ -569,7 +572,7 @@ " /sidebar Toggle sidebar (Ctrl-B)" " /quit Exit" "" - "Keys: Alt-Enter submit | PgUp/PgDn or Shift-↑/↓ scroll | Ctrl-C cancel | Shift-Tab toggle PLAN/BUILD") + "Keys: Alt-Enter submit | PgUp/PgDn or Ctrl/Alt-↑/↓ scroll | Ctrl-C cancel | Shift-Tab toggle PLAN/BUILD") "\n")))) ((equal? cmd "quit") (app-state-quit?-set! state #t))