Skip to content

Add line-by-line terminal scroll (Cmd+Swipe gesture & Cmd+Arrow keys)#2255

Open
elevateconsultingdave wants to merge 2 commits into
blinksh:rawfrom
ElevateConsultingDev:feature/scroll-line-shortcuts
Open

Add line-by-line terminal scroll (Cmd+Swipe gesture & Cmd+Arrow keys)#2255
elevateconsultingdave wants to merge 2 commits into
blinksh:rawfrom
ElevateConsultingDev:feature/scroll-line-shortcuts

Conversation

@elevateconsultingdave

Copy link
Copy Markdown

Summary

  • Cmd+Swipe gesture: Hold Command and swipe up/down on the terminal to scroll through scrollback line-by-line. Scrolls proportionally to finger movement — a long swipe covers many lines without lifting your finger.
  • Cmd+↑ / Cmd+↓ keyboard shortcuts: Scroll one line at a time via hardware keyboard. Wired through the standard shortcut pipeline and configurable in Settings → Keyboard.

Motivation

When using Blink as a remote terminal for CLI tools with verbose output (Claude Code, build logs, git diffs), the lack of fine-grained scroll control makes reviewing output impractical. Page-level scroll is too coarse, and there was no line-level mechanism available.

The Cmd+Swipe gesture is particularly valuable on iPad with a Magic Keyboard — hold Command and drag to scrub through output naturally.

Implementation

Both mechanisms delegate to hterm's existing scrollLineUp() / scrollLineDown() JS methods, keeping the UIScrollView offset in sync via the existing scrollTo bridge.

Keyboard shortcuts follow the standard 5-file pipeline:
KeyBindingActionKeyShortcut defaults → MenuControllerSpaceControllerTermView

KBTracker.loadConfig() auto-merges new defaults into existing user configs, so no migration is needed.

Cmd+Swipe intercepts the existing _pan: gesture recognizer when UIKeyModifierCommand is held, accumulating vertical translation with a 20pt-per-line threshold before delegating to scrollLineUp / scrollLineDown.

Test plan

  • Press Cmd+↑ / Cmd+↓ with scrollback content — verify single-line scroll
  • Hold Command + swipe up/down on terminal — verify continuous line-by-line scrolling
  • Verify normal touch pan (without Command held) is unaffected
  • Verify shortcuts appear in keyboard shortcut config (config → Keyboard)
  • Test on iPad with Magic Keyboard and on iPhone with external keyboard

🤖 Generated with Claude Code

elevateconsultingdave and others added 2 commits May 8, 2026 08:04
When using Blink as a remote terminal for tools like Claude Code, the
inability to scroll back through output line-by-line makes reviewing
long responses impractical. This adds two complementary scroll mechanisms:

Keyboard: Cmd+Up and Cmd+Down scroll the terminal one line at a time,
wired through the standard shortcut pipeline (KeyBindingAction,
KeyShortcut defaults, MenuController, SpaceController, TermView).
KBTracker.loadConfig() auto-merges new defaults so no migration is needed.

Touch: holding Command while panning on the terminal scrolls line-by-line
proportional to finger movement (20pt per line). This lets you scrub
through scrollback quickly without lifting your finger.

Both delegate to hterm's existing scrollLineUp/scrollLineDown JS methods,
keeping the UIScrollView offset in sync via the existing scrollTo bridge.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Xcode auto-generated changes from opening the project in Xcode 26:
project upgrade check, scheme updates, parallel build flag, and
entitlements formatting.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@carloscabanero

Copy link
Copy Markdown
Member

Hey, thanks for giving this a try!

I have to say, in this case I am a bit "disoriented" by the message. Blink supports scroll line by line by using your finger, and depending on the speed it will go faster and get inertia. So "Page-level scroll is too coarse, and there was no line-level mechanism available" does not hold true. Actually, Blink supports what this fix is supposed to do, except for the "line-by-line" using the keyboard.

Mosh does not support scroll, and that is why we usually mix it tmux (#1933).

I get that maybe we want to have line-by-line scroll using the keyboard? Or maybe even page by page using the keyboard (like pgUp or pgDown)? But that's not what this does.

I cannot test this because the commit has files that are beyond the fix - your team ID, version changes on schemas, etc... On code review, it does not look like this does what the message says it does (pan is the wrong gesture for this, the gestures that depend on pan are probably broken, etc...).

So let's start again. What do you want to do?

@elevateconsultingdave

elevateconsultingdave commented May 8, 2026 via email

Copy link
Copy Markdown
Author

@carloscabanero

Copy link
Copy Markdown
Member

That makes more sense now. So here is how we currently make this work, and let me know if after trying it out you think we would still need any more changes:

  • If you run Claude under a ssh session, regular scroll (either finger scroll or touchpad) should just work, and it should go line by line or with inertia as you expect.
  • If you run Claude under a mosh session, mosh does not have a scrollback buffer, and so Blink changes the scroll mode to use the "mouse wheel" in the remote machine. This sometimes translates to the "arrow keys" behavior that you are seeing on Claude or on shells. To get the scroll buffer we pair it with tmux or screen, and the corresponding configurations for the mouse are How to enable Mouse and Touchscreen Support on Mosh? #1949 and How do I enable Scroll on Mosh? #1933. What this makes is that when you are on tmux + Claude and scroll, it will trigger Tmux's scroll mode and allow you to control things from there.

Note the behavior is part of ssh or mosh, and Blink just adapts to it the best way possible. So the PR would not fix the situation with scroll under mosh, and the functionality already exists on ssh.

One more thing, specially interesting with the phone. I added prompt mode as well. You can turn it on with Cmd+< (in the software keyboard too). While on scratch mode, you can use the microphone, autocorrect works, you can "scroll" the buffer on tmux or ssh all the same, so you can check out what the AI wrote and prepare the reply. When ready, it will send directly to Claude. And last, you can "Pin" the mode so that you can work on the next input, etc... This mode is part of Snips itself so also very useful to prepare a command in an interface before sending it to the remote.

Let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants