Skip to content

feat(workbench): add persistent command sidebar and drafts - #956

Open
mrzj110 wants to merge 1 commit into
t8y2:mainfrom
mrzj110:feat/command-sidebar-663
Open

mrzj110 wants to merge 1 commit into
t8y2:mainfrom
mrzj110:feat/command-sidebar-663

Conversation

@mrzj110

@mrzj110 mrzj110 commented Nov 17, 2026 •

Copy link
Copy Markdown

Fixes #663.

The terminal workspace now keeps the snippet library beside the active terminal, so commands can be clicked repeatedly without reopening a popup. Selected terminal text can be saved as a snippet from its context menu, then pinned above a persistent multiline draft.

The sidebar and pins share the existing snippet records and sending channel. Library clicks preserve keyboard focus and honor each snippet's Run setting. Pinned items insert into the draft by default, with a separate direct-send button; dynamic variables resolve before either operation.

The composer supports native text input, IME, selection, undo, autosaved committed text, Ctrl+Enter, optional clearing after a successful send, and command/session-bound confirmation for high-risk drafts. It refuses oversized commands instead of truncating executable text. Collapse preferences persist, and narrow layouts preserve room for the terminal.

Framework dependency

Requires the paired Viva autofocus fix: vivaui/viva#332.

The terminal's persistent AutoFocus declaration otherwise reclaims focus from the draft after repaint. That reusable focus behavior is corrected in Viva, rather than hidden behind an application workaround, as required by #11. Motty's existing sibling-directory Viva replacement is unchanged.

Validation

  • Focused workbench suite covers snippets, repeated execution, selection capture, pin references, persistence, variable resolution, IME, undo, focus retention, risk review, and responsive layout.
  • Integration regression checks cover backgrounds, connection/restored views, AI/monitor coexistence, notes resizing, log-panel expand/restore, and specified idle paint allocation budgets.
  • Offscreen Windows rendering validates the actual product path with a fake terminal connection. Set MOTTY_COMMAND_SCREENSHOTS and run TestCommandSidebarNativeDraftFocusUndoAndLayout with -tags vivahead to reproduce the frames.
  • go vet ./..., full source formatting, diff whitespace checks, and the Windows development build passed on upstream base 4423c16da3aa3c44e19f5cb28530957e969bd856.
  • Full Motty tests are not green: the earlier complete run reported Windows/environment-specific failures and a workbench timeout. Failures have not all been compared against baseline.
  • Race testing is not available on this machine because GCC is missing.
  • Real-desktop and real-SSH acceptance remain unverified.

This change is submitted for review and CI validation. A separate script-file execution system is outside this change.

Compatibility with upstream

Validated on 2026-11-18 against main at 4423c16da3aa3c44e19f5cb28530957e969bd856.

Selection capture uses the page-owned terminal context menu. The snippet dialog keeps upstream's page fields, multiline text area, execution checkbox and shortcut buttons; the pin option uses the same page-checkbox route, with spacing that keeps the checkbox hit regions separate.

TestCommandSelectionSnippetDialogUsesPageControls follows right-click selection capture, native multiline editing, pinning and saving, and verifies that saving writes nothing to the terminal. TestCommandSidebarCoexistsWithHostsPanel covers independent session search and draft input, focus/undo, and wide/narrow layouts.

The targeted command/sidebar, hosts-panel, snippet, terminal-menu, persistence, background, split-pane, notes, remote-log, monitor, terminal-input and paste-review tests passed with -tags vivahead. go vet ./..., full source formatting, diff whitespace checks and the Windows development build passed. The full-suite, race and real-desktop/SSH limitations above still apply.

@mrzj110
mrzj110 force-pushed the feat/command-sidebar-663 branch from 2dd05bc to 36edf63 Compare November 17, 2026 02:28
mrzj110 added a commit to mrzj110/viva that referenced this pull request Nov 17, 2026
Companion Motty PR: t8y2/motty#956

AutoFocus is a reusable framework focus contract. A persistent declaration
must respect explicit sibling focus rather than requiring application-level
workarounds in Motty's command draft editor.
@mrzj110
mrzj110 force-pushed the feat/command-sidebar-663 branch from 36edf63 to 2007c60 Compare November 17, 2026 04:28
mrzj110 added a commit to mrzj110/viva that referenced this pull request Nov 17, 2026
Companion Motty PR: t8y2/motty#956

AutoFocus is a reusable framework focus contract. A persistent declaration
must respect explicit sibling focus rather than requiring application-level
workarounds in Motty's command draft editor.
@mrzj110
mrzj110 marked this pull request as ready for review November 17, 2026 06:02
Companion Viva PR: vivaui/viva#332

The persistent terminal AutoFocus declaration must respect explicit focus on
a sibling draft editor. That reusable input/focus contract belongs in Viva;
Motty consumes the framework fix through its existing sibling replacement.

Fixes t8y2#663
@mrzj110
mrzj110 force-pushed the feat/command-sidebar-663 branch from 2007c60 to 5f425e9 Compare November 18, 2026 01:32
mrzj110 added a commit to mrzj110/viva that referenced this pull request Nov 18, 2026
Companion Motty PR: t8y2/motty#956

AutoFocus is a reusable framework focus contract. A persistent declaration
must respect explicit sibling focus rather than requiring application-level
workarounds in Motty's command draft editor.
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.

[FEATURE] 将快捷命令升级为常驻侧边栏,并支持撰写框与右键创建

1 participant