From 3ce83870321fb5669339f3fce1c0fce670bd16b7 Mon Sep 17 00:00:00 2001 From: branchseer Date: Fri, 13 Feb 2026 12:47:10 +0800 Subject: [PATCH 1/2] fix: ignore Enter key when no tasks match the search query Previously, pressing Enter with zero filtered results would exit the interactive task selector without selecting anything. Now it does nothing, keeping the selector open so the user can refine their search. --- crates/vite_select/src/interactive.rs | 7 ++- .../fixtures/task-select/snapshots.toml | 8 +++ ...ve enter with no results does nothing.snap | 58 +++++++++++++++++++ packages/tools/package.json | 16 +++++ 4 files changed, 86 insertions(+), 3 deletions(-) create mode 100644 crates/vite_task_bin/tests/e2e_snapshots/fixtures/task-select/snapshots/interactive enter with no results does nothing.snap diff --git a/crates/vite_select/src/interactive.rs b/crates/vite_select/src/interactive.rs index b7a78e7f..33cc6f41 100644 --- a/crates/vite_select/src/interactive.rs +++ b/crates/vite_select/src/interactive.rs @@ -297,9 +297,10 @@ pub fn run( std::process::exit(130); } KeyCode::Enter => { - if let Some(idx) = state.selected_original_index() { - *selected_index = idx; - } + let Some(idx) = state.selected_original_index() else { + continue; + }; + *selected_index = idx; cleanup(&mut out, &state)?; return Ok(()); } diff --git a/crates/vite_task_bin/tests/e2e_snapshots/fixtures/task-select/snapshots.toml b/crates/vite_task_bin/tests/e2e_snapshots/fixtures/task-select/snapshots.toml index fc9c0672..ddea03ae 100644 --- a/crates/vite_task_bin/tests/e2e_snapshots/fixtures/task-select/snapshots.toml +++ b/crates/vite_task_bin/tests/e2e_snapshots/fixtures/task-select/snapshots.toml @@ -117,6 +117,14 @@ steps = [ { command = "vp run", interactions = [{ "expect-milestone" = "task-select::0" }, { "write" = "t" }, { "expect-milestone" = "task-select:t:0" }, { "write-key" = "enter" }] }, ] +# Interactive: Enter with no matching results does nothing +[[e2e]] +name = "interactive enter with no results does nothing" +cwd = "packages/app" +steps = [ + { command = "vp run", interactions = [{ "expect-milestone" = "task-select::0" }, { "write" = "zzzzz" }, { "expect-milestone" = "task-select:zzzzz:0" }, { "write-key" = "enter" }, { "write-key" = "escape" }, { "expect-milestone" = "task-select::0" }, { "write-key" = "enter" }] }, +] + # Typo inside a task script should fail with an error, NOT show a list [[e2e]] name = "typo in task script fails without list" diff --git a/crates/vite_task_bin/tests/e2e_snapshots/fixtures/task-select/snapshots/interactive enter with no results does nothing.snap b/crates/vite_task_bin/tests/e2e_snapshots/fixtures/task-select/snapshots/interactive enter with no results does nothing.snap new file mode 100644 index 00000000..dfeebaf9 --- /dev/null +++ b/crates/vite_task_bin/tests/e2e_snapshots/fixtures/task-select/snapshots/interactive enter with no results does nothing.snap @@ -0,0 +1,58 @@ +--- +source: crates/vite_task_bin/tests/e2e_snapshots/main.rs +expression: e2e_outputs +--- +> vp run +@ expect-milestone: task-select::0 +Search task (↑/↓ to move, enter to select): +> build: echo build app + lint: echo lint app + test: echo test app + lib#build: echo build lib + lib#lint: echo lint lib + lib#test: echo test lib + lib#typecheck: echo typecheck lib + task-select-test#check: echo check root + task-select-test#clean: echo clean root + task-select-test#deploy: echo deploy root + task-select-test#docs: echo docs root + task-select-test#format: echo format root + (…3 more) +@ write: zzzzz +@ expect-milestone: task-select:zzzzz:0 +Search task (↑/↓ to move, enter to select): zzzzz + No matching tasks. +@ write-key: enter +@ write-key: escape +@ expect-milestone: task-select::0 +Search task (↑/↓ to move, enter to select): +> build: echo build app + lint: echo lint app + test: echo test app + lib#build: echo build lib + lib#lint: echo lint lib + lib#test: echo test lib + lib#typecheck: echo typecheck lib + task-select-test#check: echo check root + task-select-test#clean: echo clean root + task-select-test#deploy: echo deploy root + task-select-test#docs: echo docs root + task-select-test#format: echo format root + (…3 more) +@ write-key: enter +~/packages/app$ echo build app ⊘ cache disabled: built-in command +build app + + +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + Vite+ Task Runner • Execution Summary +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + +Statistics: 1 tasks • 0 cache hits • 0 cache misses • 1 cache disabled +Performance: 0% cache hit rate + +Task Details: +──────────────────────────────────────────────── + [1] app#build: ~/packages/app$ echo build app ✓ + → Cache disabled for built-in command +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ diff --git a/packages/tools/package.json b/packages/tools/package.json index e770356f..08104b5f 100644 --- a/packages/tools/package.json +++ b/packages/tools/package.json @@ -9,6 +9,22 @@ "json-edit": "./src/json-edit.ts", "replace-file-content": "./src/replace-file-content.ts" }, + "scripts": { + "build": "tsc -p tsconfig.build.json tsc -p tsconfig.build.jsontsc -p tsconfig.build.jsontsc -p tsconfig.build.jsontsc -p tsconfig.build.jsontsc -p tsconfig.build.json -p tsconfig.build.json -p tsconfig.build.json -p tsconfig.build.json -p tsconfig.build.json", + "lint": "oxlint --fix", + "lint:tsgolint": "oxlint-tsgolint --fix", + "lint:tsgolint2": "oxlint-tsgolint --fix", + "lint:tsgolin2": "oxlint-tsgolint --fix", + "lint:tsgolt2": "oxlint-tsgolint --fix", + "lint:tsgint2": "oxlint-tsgolint --fix", + "lint:tsolint2": "oxlint-tsgolint --fix", + "lint:tgolint2": "oxlint-tsgolint --fix", + "lint:sgolint2": "oxlint-tsgolint --fix", + "lin:tsgolint2": "oxlint-tsgolint --fix", + "linttsgolint2": "oxlint-tsgolint --fix", + "lit:tsgolint2": "oxlint-tsgolint --fix", + "lnt:tsgolint2": "oxlint-tsgolint --fix" + }, "dependencies": { "cross-env": "^10.1.0", "oxfmt": "0.26.0", From 0ff08a05b386dadadf3a494e2951a9c69af875ae Mon Sep 17 00:00:00 2001 From: branchseer Date: Fri, 13 Feb 2026 12:50:24 +0800 Subject: [PATCH 2/2] revert: remove accidental changes to packages/tools/package.json --- packages/tools/package.json | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/packages/tools/package.json b/packages/tools/package.json index 08104b5f..e770356f 100644 --- a/packages/tools/package.json +++ b/packages/tools/package.json @@ -9,22 +9,6 @@ "json-edit": "./src/json-edit.ts", "replace-file-content": "./src/replace-file-content.ts" }, - "scripts": { - "build": "tsc -p tsconfig.build.json tsc -p tsconfig.build.jsontsc -p tsconfig.build.jsontsc -p tsconfig.build.jsontsc -p tsconfig.build.jsontsc -p tsconfig.build.json -p tsconfig.build.json -p tsconfig.build.json -p tsconfig.build.json -p tsconfig.build.json", - "lint": "oxlint --fix", - "lint:tsgolint": "oxlint-tsgolint --fix", - "lint:tsgolint2": "oxlint-tsgolint --fix", - "lint:tsgolin2": "oxlint-tsgolint --fix", - "lint:tsgolt2": "oxlint-tsgolint --fix", - "lint:tsgint2": "oxlint-tsgolint --fix", - "lint:tsolint2": "oxlint-tsgolint --fix", - "lint:tgolint2": "oxlint-tsgolint --fix", - "lint:sgolint2": "oxlint-tsgolint --fix", - "lin:tsgolint2": "oxlint-tsgolint --fix", - "linttsgolint2": "oxlint-tsgolint --fix", - "lit:tsgolint2": "oxlint-tsgolint --fix", - "lnt:tsgolint2": "oxlint-tsgolint --fix" - }, "dependencies": { "cross-env": "^10.1.0", "oxfmt": "0.26.0",