Repository navigation
Conversation
1b43c7e to
2bec420
Compare
The GPUI shell had no clear-screen action at all: the macOS config table's ⌘K ClearHistory default executes only in the legacy shell, so after unbinding the Shell picker row ⌘K stayed inert and no settings row offered clear screen — the known limitation recorded in the 2026-09-21 macOS command-key aliases note. Map config::Action::ClearHistory to a new ClearTerminal workspace action and expose it as a Terminal-group row on the settings keymap page. No default shortcut changes on any platform: ⌘K stays on the Shell picker, and the feature is opt-in through a user keybind= row that applies without restart. After an instant app-side wipe of the viewport and scrollback, the action branches on the pane's foreground state: at a prompt it writes ^L to the pane's PTY so the shell repaints its prompt on the fresh screen; while a command runs it moves the terminal cursor home app-side so sequential output continues from the top; on the alternate screen it does nothing. The row label uses a typed i18n message (zh/en catalogs, English fallback elsewhere). Adds adapter, dispatch-probe and label regressions, and the decision note architecture/notes/nebula_app/gpui_shell/2026-10-14-terminal-clear-action.md (recording why pre-existing files need one re-record after upgrading, and why an app-side cursor-home and an unconditional ^L were rejected).
…trol group The platform-cfg ratchet counts cfg! macros outside platform/ and the clear-screen adapter regression added one. Build the static default keymap identically on every platform instead: the precedence being tested is source-tier, not platform-specific, and the macOS-only registration behavior stays guarded by its own runtime-platform test.
…policy Upstream cf77ccd releases plain Control-character workspace defaults on macOS, so the Shell picker's Ctrl+K default may legitimately be absent. Derive the Ctrl+K expectation from the control group's own shape instead of asserting it unconditionally; the user clear binding must neither steal a present default nor resurrect a released key.
10520b6 to
94cdb39
Compare
|
Added focused maintainer fixes at 92516fe and merged the current main baseline. The actual TerminalView tests now cover prompt-only Ctrl+L delivery, no PTY input while a command runs, cursor-home/history/selection clearing, and an unchanged alternate screen plus primary history. The macOS keymap regression preserves Command+K ownership for the Shell picker; the stale note has been corrected. Windows validation: The action is user-triggered: it reuses the terminal's existing bounded grid/history clear operations and adds one prompt-state branch, with no polling or background work. Native shell redraw acceptance remains distinct from the standalone PTY regression fixtures. |
Kuddev
left a comment
There was a problem hiding this comment.
Reviewed db35ebd. All five actual Native tests jobs and both macOS release workspace checks passed on this head. The clear action now reaches the focused GPUI terminal; focused regression cases verify prompt-only Ctrl+L, running-command cursor reset without PTY input, cleared viewport/history/selection, and an unchanged alternate screen. The shortcut policy retains Command+K for the macOS Shell picker, with Clear screen unbound until explicitly assigned.
This is a user-triggered operation using the existing grid/history clear primitives, with no polling, extra subprocess, or per-frame work. Windows focused tests and architecture checks passed locally. The standalone PTY fixture proves dispatched bytes and terminal state; it is not a claim that every third-party shell redraw behavior was exercised.
|
The Re-running via an empty push; if it fails again consistently, it reproduces independently of this branch and likely needs a look upstream. |
|
The re-run failed on the same case: This branch changes nothing under Since PR authors cannot re-run upstream jobs, could a maintainer re-run the failed job once? If it keeps failing there while |
…nal-action # Conflicts: # nebula_app/src/display/keymap.rs
|
Friendly ping for a re-review. Your Oct 19 approval was dismissed as stale by the follow-up pushes (the repo requires approval of the latest reviewable push), and PR authors cannot re-request reviewers, so this comment is the nudge. The branch is now conflict-free against |
Result / 用户结果
Users can now bind a clear-screen shortcut themselves. The GPUI shell had no clear-screen action at all: the macOS config table's
⌘K → ClearHistorydefault executes only in the legacy shell, so after unbinding the Shell picker row ⌘K stayed inert and no settings row offered clear screen — the known limitation recorded in the 2026-09-21 macOS command-key aliases note ("⌘K after unbinding does not clear the screen").Settings → Key Bindings gains a Terminal-group "Clear screen / 清屏" row. No default shortcut changes on any platform: ⌘K stays on the Shell picker, and the feature is opt-in through a user
keybind=row (e.g.keybind=cmd+k:ClearHistory) that applies without restart.Design / 设计边界
gpui_shell/workspace/keyboard_bindings.rsmapsconfig::Action::ClearHistoryto a newClearTerminalworkspace action (alongside theSelectTab/QuitAppadapter actions);gpui_shell/terminal/view.rsimplements the pane-level clear;display/keymap.rsowns the editable row; catalogs addcommon.clear_screen. The existing keymap authority (config table +MACOS_COMMAND_ALIASESunbind vocabulary) is reused unchanged.ClearMode::All+Saved), the action branches on the pane's foreground state:nebula_prompt_active): writes^Lto that pane's PTY so the shell repaints its prompt on the fresh screen with its line state in sync (same visible behavior as the legacy ⌘K pair).^Lwould clear the screen a second time when the command exits, wiping the output produced in between. The view moves the terminal cursor home app-side; sequential output continues from the top.^Lis a redraw there, not a clear.^Lis a direct PTY write on the focused pane, not a user-input event, so broadcast fan-out is untouched.architecture/notes/nebula_app/gpui_shell/2026-10-14-terminal-clear-action.md.Evidence / 验证依据
cargo fmt --all -- --check;cargo check -p nebula --bin pebrel --features gpui-shell --tests --locked(0 errors);keyboard_bindings25 passed (including thegpui-test-supportdispatch module),display::keymap46 passed,settings_pane24 passed, i18n contract 24 passed,nebula-settings99 passed,file_line_budget2 passed;python3 scripts/check_architecture.py --base <merge-base 13659697>passes with budgets unchanged — the new action lives inkeyboard_bindings.rsspecifically becauseworkspace.rssits at its ratcheted 2773-line budget.clear_history_maps_to_the_clear_terminal_actionfails without the adapter arm (a user-bound clear must win over the static ⌘K picker binding while Ctrl+K stays on the picker);clear_screen_shortcut_dispatches_and_stays_out_of_the_terminal_streamfails without the dispatch path (the key must not enter the PTY input stream);clear_screen_is_editable_and_localized_through_the_typed_messagefails without the catalog entries.PEBREL_CONFIG_DIR): prompt clear repaints at the top-left, clear during a running command keeps output flowing from the top, vim is untouched, the Shell picker keeps Ctrl+K, and the binding survives restart. Platform/feature coverage limitation: Windows/Linux paths rely on the shared keymap tests and CI; no native manual run there.Required Review / 必须确认
CONTRIBUTING.md,docs/architecture.md, anddocs/project-constraints.md.python3 scripts/check_architecture.py --base <PR-base-commit>passes; budgets were not inflated to fit the change.