Skip to content

fix(session): show the selected session's terminal after a tab switch - #9

Open
andreas-byfut wants to merge 1 commit into
LordOfPolls:masterfrom
andreas-byfut:fix/key-session-tab-body
Open

andreas-byfut wants to merge 1 commit into
LordOfPolls:masterfrom
andreas-byfut:fix/key-session-tab-body

Conversation

@andreas-byfut

Copy link
Copy Markdown
Contributor

Switching to a disconnected, failed or reconnecting tab kept drawing the previous session's
emulator, and selecting or copying then acted on the wrong buffer.

  • Each SessionTabBody call site is wrapped in key(sessionId), so every session gets its own
    emulator, scrollback, selection and latched modifiers.
  • The body adopts the connection's emulator for every status except CONNECTING, so a dropped or
    reconnecting session keeps its last screen.
  • The pinch-zoomed font size lives in SessionBodyShared, outside the key, so it is still shared
    across tabs.
  • TerminalInputCapture sets showKeyboardOnFocus = false, so a freshly composed field does not
    raise the keyboard on every tab switch. A tap on the terminal now shows it explicitly.
  • SessionBodyShared.shown marks the first body composed after entering the Sessions screen. That
    one raises the keyboard, as before. A tab switch keeps the keyboard up only if it was already up.

Behaviour change: the keyboard no longer comes back by itself when focus returns after the link
dialog or the overflow menu closes. Tap the terminal or the keyboard key to bring it back.

Switching to a disconnected, failed or reconnecting tab kept drawing the
previous session's emulator, and selecting or copying then acted on the wrong
buffer.

- Each SessionTabBody call site is wrapped in key(sessionId), so every
  session gets its own emulator, scrollback, selection and latched modifiers.
- The body adopts the connection's emulator for any status except CONNECTING,
  so a dropped or reconnecting session keeps showing its last screen.
- The pinch-zoomed font size lives in SessionBodyShared, outside the key, so
  it is still shared across tabs.
- The terminal field no longer shows the keyboard when it gains focus. A
  freshly composed field takes focus on every tab switch and would otherwise
  raise it.
- Tapping the terminal shows the keyboard explicitly.
- SessionBodyShared.shown tells the first body composed after entering the
  Sessions screen from one composed by a tab switch. The first raises the
  keyboard, as before; a switch keeps it up only if it was up.

Not tested on a device: the keyboard behaviour needs a device check.
@LordOfPolls

Copy link
Copy Markdown
Owner

Thanks, was able to replicate.
Minor issues.
The keyboard changes break the soft keyboard, though: with showKeyboardOnFocus = false the IME never comes up, whether you enter a session, tap the key bar button or tap the terminal.
Please keep key(sessionId), adopting the emulator unless the session is connecting, and the shared font size.
Please drop showKeyboardOnFocus = false, ``SessionBodyShared.shown`, show-on-tap.
Remember(sessionId) and LaunchedEffect(sessionId) are redundant under key(sessionId), and the "Fresh state per session" comments can go.

@LordOfPolls LordOfPolls added bug Something isn't working needs-revision labels Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working needs-revision

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants