From e228d11ef973be286341dcee17d0b5b458e04bb7 Mon Sep 17 00:00:00 2001 From: danny Date: Mon, 2 Nov 2026 17:55:58 +0100 Subject: [PATCH] C1: alpha dry run fixes (Ctrl+C in terminal, ignored colour, find singular) - Terminal: undo an inherited "ignore Ctrl+C" flag before starting a ConPTY shell (lutra_proc::enable_ctrl_c). Lutra started by the lutra CLI (CREATE_NEW_PROCESS_GROUP) passed it to every shell, so Ctrl+C stopped nothing. Test reruns itself with that flag. - Engine: an edited .gitignore/.ignore reports TreeChanged for its folder, so the tree greys newly ignored files (Add to .gitignore). - Find: "1 match", "1 file" instead of "1 files". - docs/alpha-checklist.md: steps corrected after the Windows dry run. Co-Authored-By: Claude Opus 5.5 --- crates/engine/src/workspace.rs | 18 ++++++++- crates/engine/tests/workspace.rs | 23 +++++++++++ crates/proc/Cargo.toml | 1 + crates/proc/src/lib.rs | 15 +++++++- crates/proc/src/windows.rs | 23 ++++++++++- crates/terminal/src/session.rs | 7 ++++ crates/terminal/tests/session.rs | 47 +++++++++++++++++++++++ docs/alpha-checklist.md | 23 +++++------ ui/src/components/find/FindToolWindow.vue | 17 +++++++- ui/src/i18n/en.json | 10 +++-- ui/tests/find/FindToolWindow.test.ts | 9 +++++ 11 files changed, 173 insertions(+), 20 deletions(-) diff --git a/crates/engine/src/workspace.rs b/crates/engine/src/workspace.rs index 5b2ba66..795b744 100644 --- a/crates/engine/src/workspace.rs +++ b/crates/engine/src/workspace.rs @@ -234,9 +234,18 @@ pub fn sync_buffer_dirs(state: &mut State) { workspace.pin_dirs(dirs); } +/// Whether `path` is an ignore file (`.gitignore`, `.ignore`) whose rules +/// decide the `ignored` flag of the entries listed next to it. +fn is_ignore_file(path: &Path) -> bool { + path.file_name() + .is_some_and(|name| name == ".gitignore" || name == ".ignore") +} + /// Applies pending changes on disk to the state: hands them to the symbol /// index ([`crate::cmd::goto::note_disk_changes`]), queues -/// [`Event::TreeChanged`] for affected directories, reloads clean buffers +/// [`Event::TreeChanged`] for affected directories (also for the directory +/// of an edited ignore file, whose entries may change their `ignored` +/// flag), reloads clean buffers /// whose file changed, and queues [`Event::FileChangedOnDisk`] for dirty /// buffers and for buffers whose file disappeared. pub fn pump(state: &mut State) { @@ -268,7 +277,12 @@ pub fn pump(state: &mut State) { add_dir(&to); gone.push(from); } - VfsEvent::Modified { path } => modified.push(path), + VfsEvent::Modified { path } => { + if is_ignore_file(&path) { + add_dir(&path); + } + modified.push(path); + } VfsEvent::Failed(_) => {} } } diff --git a/crates/engine/tests/workspace.rs b/crates/engine/tests/workspace.rs index 265ae2c..d56210b 100644 --- a/crates/engine/tests/workspace.rs +++ b/crates/engine/tests/workspace.rs @@ -381,6 +381,29 @@ fn tree_changes_are_reported_for_listed_directories() { ); } +#[test] +fn editing_gitignore_reports_its_directory_with_the_new_ignored_flag() { + let (dir, mut engine, _) = open_project(&[(".gitignore", b"/var/\n"), ("notes.txt", b"note")]); + let ignored = |engine: &mut Engine| { + let listing = run(engine, "project.children", json!({"dir": ""})).value; + listing["entries"] + .as_array() + .unwrap() + .iter() + .find(|e| e["name"] == "notes.txt") + .unwrap()["ignored"] + .as_bool() + .unwrap() + }; + assert!(!ignored(&mut engine)); + fs::write(dir.path().join(".gitignore"), "/var/\n/notes.txt\n").unwrap(); + wait_for( + &mut engine, + |e| matches!(e, Event::TreeChanged { dir } if dir.is_empty()), + ); + assert!(ignored(&mut engine)); +} + #[test] fn watched_directories_are_capped_least_recently_listed_first() { let (dir, mut engine, _) = open_project(&[]); diff --git a/crates/proc/Cargo.toml b/crates/proc/Cargo.toml index 72718ab..6d747ec 100644 --- a/crates/proc/Cargo.toml +++ b/crates/proc/Cargo.toml @@ -21,6 +21,7 @@ doc = false windows-sys = { version = "0.61.2", features = [ "Win32_Foundation", "Win32_Security", + "Win32_System_Console", "Win32_System_Diagnostics_ToolHelp", "Win32_System_JobObjects", "Win32_System_Threading", diff --git a/crates/proc/src/lib.rs b/crates/proc/src/lib.rs index 27475eb..8f441b5 100644 --- a/crates/proc/src/lib.rs +++ b/crates/proc/src/lib.rs @@ -35,7 +35,8 @@ //! //! [`adopt`] (Windows) puts a process started by someone else, the //! integrated terminal's ConPTY shell, into a kill-on-close job and returns -//! a [`Guard`] that holds it. +//! a [`Guard`] that holds it. [`enable_ctrl_c`] (Windows) undoes an +//! inherited "ignore Ctrl+C" flag before that shell starts. use std::io; use std::ops::{Deref, DerefMut}; @@ -169,6 +170,18 @@ pub fn adopt(process: std::os::windows::io::RawHandle) -> io::Result { Group::adopt(process).map(|group| Guard { group }) } +/// Undoes an inherited "ignore Ctrl+C" flag (Windows only), so console +/// programs started from now on, such as the integrated terminal's shell +/// and what it runs, get Ctrl+C. Lutra inherits that flag when it is +/// started with `CREATE_NEW_PROCESS_GROUP`, as the `lutra` CLI does. +/// +/// # Errors +/// The OS error of `SetConsoleCtrlHandler`. +#[cfg(windows)] +pub fn enable_ctrl_c() -> io::Result<()> { + windows::enable_ctrl_c() +} + #[cfg(windows)] impl Guard { /// Terminates every process in the job. diff --git a/crates/proc/src/windows.rs b/crates/proc/src/windows.rs index 4a9a2b8..c2aa990 100644 --- a/crates/proc/src/windows.rs +++ b/crates/proc/src/windows.rs @@ -15,8 +15,12 @@ //! [`Group::adopt`] puts a process someone else started (the terminal's //! ConPTY shell) into a new job by its handle. //! +//! [`enable_ctrl_c`] undoes an inherited "ignore Ctrl+C" flag +//! (`SetConsoleCtrlHandler(NULL, FALSE)`), so the terminal's shells pass +//! Ctrl+C on to the programs they run. +//! //! This is the one module in Lutra that allows `unsafe`: the job object, -//! Tool Help and thread APIs are only reachable through FFI. Every call gets +//! Tool Help, thread and console APIs are only reachable through FFI. Every call gets //! valid arguments by construction: handles come from `CreateJobObjectW`, //! `CreateToolhelp32Snapshot` or `OpenThread` (owned by an [`OwnedHandle`] //! right away) or from a live [`std::process::Child`], and the limit and @@ -30,6 +34,7 @@ use std::os::windows::process::CommandExt; use std::process::Command; use windows_sys::Win32::Foundation::INVALID_HANDLE_VALUE; +use windows_sys::Win32::System::Console::SetConsoleCtrlHandler; use windows_sys::Win32::System::Diagnostics::ToolHelp::{ CreateToolhelp32Snapshot, TH32CS_SNAPTHREAD, THREADENTRY32, Thread32First, Thread32Next, }; @@ -45,6 +50,22 @@ use windows_sys::Win32::System::Threading::{ /// The exit code a process killed with its job reports. const KILLED_EXIT_CODE: u32 = 1; +/// Lets this process, and the console programs it starts from now on, +/// handle Ctrl+C again: `SetConsoleCtrlHandler(NULL, FALSE)`. +/// +/// A process started with `CREATE_NEW_PROCESS_GROUP` (the `lutra` CLI +/// starts Lutra that way) ignores Ctrl+C, and its children inherit that. +/// +/// # Errors +/// The OS error of `SetConsoleCtrlHandler`. +pub(crate) fn enable_ctrl_c() -> io::Result<()> { + let ok = unsafe { SetConsoleCtrlHandler(None, 0) }; + if ok == 0 { + return Err(io::Error::last_os_error()); + } + Ok(()) +} + /// The job a child runs in. Lutra holds the only handle; closing it (on /// drop, or when Lutra's process ends) kills every process in the job. pub(crate) struct Group { diff --git a/crates/terminal/src/session.rs b/crates/terminal/src/session.rs index cee766d..3517be3 100644 --- a/crates/terminal/src/session.rs +++ b/crates/terminal/src/session.rs @@ -184,6 +184,11 @@ fn spawn_error(e: impl std::fmt::Display) -> TerminalError { impl Session { /// Starts a shell in a new pseudo terminal. /// + /// On Windows it first undoes an "ignore Ctrl+C" flag Lutra may have + /// inherited ([`lutra_proc::enable_ctrl_c`]), because the shell and the + /// programs it runs inherit it in turn and Ctrl+C would stop nothing. A + /// failure there is ignored: the shell works without it. + /// /// # Errors /// [`TerminalError::InvalidSize`] for a size outside `1..=MAX_SIZE`, /// [`TerminalError::Spawn`] if the pty cannot be created, the program @@ -210,6 +215,8 @@ impl Session { for (key, value) in &options.env { cmd.env(key, value); } + #[cfg(windows)] + let _ = lutra_proc::enable_ctrl_c(); let mut child = pair.slave.spawn_command(cmd).map_err(spawn_error)?; drop(pair.slave); #[cfg(windows)] diff --git a/crates/terminal/tests/session.rs b/crates/terminal/tests/session.rs index 13d47e7..4ea666f 100644 --- a/crates/terminal/tests/session.rs +++ b/crates/terminal/tests/session.rs @@ -261,3 +261,50 @@ fn spawn_errors() { Err(TerminalError::InvalidSize { cols: 0, rows: 24 }) )); } + +/// Set for the copy of this test binary that +/// [`ctrl_c_stops_a_program_when_lutra_ignores_ctrl_c`] starts. +#[cfg(windows)] +const CTRL_C_CHILD: &str = "LUTRA_TERMINAL_CTRL_C_CHILD"; + +/// Ctrl+C in the terminal stops a running program even when Lutra was +/// started with `CREATE_NEW_PROCESS_GROUP` (as `lutra` starts it), which +/// makes a process and its children ignore Ctrl+C. Runs +/// [`ctrl_c_child`] in a copy of this test binary started that way. +#[cfg(windows)] +#[test] +fn ctrl_c_stops_a_program_when_lutra_ignores_ctrl_c() { + use std::os::windows::process::CommandExt; + const CREATE_NEW_PROCESS_GROUP: u32 = 0x0000_0200; + let out = std::process::Command::new(std::env::current_exe().unwrap()) + .args(["--exact", "ctrl_c_child", "--nocapture", "--test-threads=1"]) + .env(CTRL_C_CHILD, "1") + .creation_flags(CREATE_NEW_PROCESS_GROUP) + .output() + .unwrap(); + let text = + String::from_utf8_lossy(&out.stdout).into_owned() + &String::from_utf8_lossy(&out.stderr); + assert!(out.status.success(), "{text}"); + assert!(text.contains("1 passed"), "{text}"); +} + +/// The part of [`ctrl_c_stops_a_program_when_lutra_ignores_ctrl_c`] that +/// runs in the copy; does nothing in a normal test run. +#[cfg(windows)] +#[test] +fn ctrl_c_child() { + if std::env::var_os(CTRL_C_CHILD).is_none() { + return; + } + let s = spawn(interactive(), 120); + s.write(b"ping -n 60 127.0.0.1\r").unwrap(); + let (out, exit) = drive(&s, |out| out.matches("127.0.0.1").count() >= 3); + assert!(exit.is_none(), "{out:?}"); + s.write(b"\x03").unwrap(); + s.write(b"echo lutra-after-%OS%\r").unwrap(); + let started = Instant::now(); + let (out, exit) = drive(&s, |out| out.contains("lutra-after-Windows")); + assert!(exit.is_none(), "{out:?}"); + assert!(out.contains("lutra-after-Windows"), "{out:?}"); + assert!(started.elapsed() < Duration::from_secs(20), "{out:?}"); +} diff --git a/docs/alpha-checklist.md b/docs/alpha-checklist.md index dd20d7d..09759ad 100644 --- a/docs/alpha-checklist.md +++ b/docs/alpha-checklist.md @@ -41,7 +41,7 @@ PHP 8.2 or newer must be installed (`php -v`). Without it, steps 3.x fail with a | 1.12 | **Crash recovery, preparation.** Settings › Editor: turn off "Autosave when leaving the window" and set "Autosave after idle (seconds)" to 0. | Both apply at once. | [ ] | [ ] | | 1.13 | Type `Unsaved line` into `composer.json` without saving, wait 3 seconds, then kill Lutra hard. Windows: `taskkill /F /IM lutra-desktop.exe`. macOS: `pkill -9 lutra-desktop`. (This ends every running Lutra.) | The window disappears at once, without a question. | [ ] | [ ] | | 1.14 | Start Lutra again and open `DEMO/shop`. | A dialog "Unsaved changes found" lists `composer.json`. "Restore All" opens it as a modified tab with `Unsaved line` in it. | [ ] | [ ] | -| 1.15 | Remove `Unsaved line`, save. In Settings › Editor, reset both autosave settings to their defaults. | `composer.json` is no longer modified (no colour in the tree). | [ ] | [ ] | +| 1.15 | Remove the text `Unsaved line` (leave the line break after the closing `}`), save. In Settings › Editor, reset both autosave settings to their defaults. | `composer.json` is no longer modified (no colour in the tree). | [ ] | [ ] | ## 2. Navigation (about 5 min) @@ -50,7 +50,7 @@ PHP 8.2 or newer must be installed (`php -v`). Without it, steps 3.x fail with a | 2.1 | Go to File: `Mod+P`, type `pricecalc`. | `src/Service/PriceCalculator.php` is the first row, with the matched letters marked. Enter opens it. | [ ] | [ ] | | 2.2 | Go to Class: `Mod+Alt+C`, type `repo`. | `ProductRepository` (interface) and `InMemoryProductRepository`, with their namespace. Tab switches between the File, Class and Symbol modes and keeps the text. | [ ] | [ ] | | 2.3 | Go to Symbol: `Mod+T`, type `Checkout::total`, Enter. | `Checkout.php` opens with the cursor on `total`. Typing `format` instead lists the function `format_price`. | [ ] | [ ] | -| 2.4 | Structure: with `Checkout.php` active, `Mod+2`. | A tree: `Checkout` with `__construct`, `$products`, `$calculator`, `total`, `preview`. Clicking `preview` puts the cursor on it. `Mod+2` again hides it. | [ ] | [ ] | +| 2.4 | Structure: with `Checkout.php` active, `Mod+2`. | A tree: the namespace `Demo\Shop\Service`, under it `Checkout` with `__construct`, `$products`, `$calculator`, `total`, `preview`. Clicking `preview` puts the cursor on it. `Mod+2` again hides it. | [ ] | [ ] | | 2.5 | Find in Files: `Mod+Alt+F`, type `VAT_RATE`, Enter. | The Find tab at the bottom: 2 matches in 1 file, each with line number and the match marked. Enter or a click on a match opens the file there. | [ ] | [ ] | | 2.6 | Search for `ignored by`. | "No matches": the log file in the ignored `var/` folder isn't searched. | [ ] | [ ] | | 2.7 | Turn on Regex and search `gross\w*\(`. | Matches in `PriceCalculator.php` and `Checkout.php`. An invalid regex such as `(` shows an error under the field, not a toast. | [ ] | [ ] | @@ -64,12 +64,12 @@ Wait until the language server is ready: the status bar shows indexing progress | 3.1 | Open `src/Service/Checkout.php`. | Within a few seconds `grossPrice` on line 51 gets a red wavy underline (the demo's deliberate error). Hovering it shows `Method "grossPrice" does not exist on class "Demo\Shop\Service\PriceCalculator"`. | [ ] | [ ] | | 3.2 | Problems: `Mod+Alt+P`. | The Problems tab lists that error under `Checkout.php`, with line 51. Enter or a click jumps to it. | [ ] | [ ] | | 3.3 | Change `grossPrice` to `gross` on line 51. | The underline and the Problems entry disappear within a few seconds. | [ ] | [ ] | -| 3.4 | On line 42, delete the `;` after `format_price($sum)` and save. | An error is reported on that line (on Windows from `php -l`, after the save). Put the `;` back and save; it goes away. | [ ] | [ ] | +| 3.4 | On line 42, delete the `;` after `format_price($sum)` and save. | An error is reported on line 43, the `}` after the missing `;` (on Windows from `php -l`, after the save). Put the `;` back and save; it goes away. | [ ] | [ ] | | 3.5 | Completion: on a new line in `preview()`, type `$this->calculator->`. | A list opens with `gross` and `grossFor`, with kind icons. Enter inserts the chosen one. `Ctrl+Space` opens the list on demand. Undo the line. | [ ] | [ ] | | 3.6 | Hover: rest the mouse on `PriceCalculator` in the constructor. Then put the cursor on it and press `Mod+I`. | A tooltip with the class's doc comment, "Turns net prices into gross prices.", both ways. | [ ] | [ ] | -| 3.7 | Signature help: on a new line, type `format_price(1.5, `. | A tooltip shows `format_price(float $amount, string $currency = 'EUR', int $decimals = 2)` with `$currency` marked. Escape closes it; `Mod+Shift+Space` brings it back. Undo the line. | [ ] | [ ] | +| 3.7 | Signature help: on a new line in `preview()`, type `round(1.5, ` (the editor adds the `)`). | A tooltip shows `round(int\|float $num, int $precision = 0, int $mode = NULL): float` with `$precision` marked. (Phpactor shows none for namespaced functions such as `format_price`; that is not a Lutra failure.) Escape closes it; `Mod+Shift+Space` brings it back. Undo the line. | [ ] | [ ] | | 3.8 | Definition: cursor on `findBySku` (line 33), `F12`. Then `Mod`+click on `PriceCalculator` in the constructor. | The first opens `ProductRepository.php` (or a picker that includes it) at `findBySku`; the second opens `PriceCalculator.php`. | [ ] | [ ] | -| 3.9 | References: in `src/Model/Product.php`, cursor on the class name `Product`, `Shift+F12`. | A References tab lists the uses in `ProductRepository.php`, `InMemoryProductRepository.php`, `PriceCalculator.php` and `public/index.php`, each with its line. A click opens the use. | [ ] | [ ] | +| 3.9 | References: in `src/Model/Product.php`, cursor on the class name `Product`, `Shift+F12`. | A References tab lists the uses in `ProductRepository.php`, `InMemoryProductRepository.php`, `PriceCalculator.php` and `public/index.php`, each with its line, plus the class itself in `Product.php`. A click opens the use. | [ ] | [ ] | | 3.10 | Rename: in `ProductRepository.php`, cursor on `findBySku`, `F2`, type `findProduct`, Enter. | A field shows "Changes N uses in M files" before you confirm. Afterwards a toast reports the rename; the interface, `InMemoryProductRepository.php` and `Checkout.php` all say `findProduct`, and no new error appears in Problems. Keep the change (it is committed in 5.4). | [ ] | [ ] | ## 4. Terminal (about 3 min) @@ -91,19 +91,19 @@ Before this section: `DEMO/shop` has the changes from 1.3, 3.3 and 3.10. The dem | # | Action | Expected | Win | Mac | |---|---|---|---|---| | 5.1 | In the terminal: `echo note > notes.txt`. | `notes.txt` appears in the tree in the "untracked" colour. | [ ] | [ ] | -| 5.2 | Open `README.md`, Git › Show Diff (`Mod+Alt+Shift+D`). Then Git › Next Change (`Alt+Shift+]`) and Previous Change (`Alt+Shift+[`). | A "Diff: README.md" tab shows the committed version left and your copy right, with the new lines highlighted. Next/Previous move the cursor between changed chunks, wrapping. Typing on the right edits the file. | [ ] | [ ] | +| 5.2 | Open `README.md`, Git › Show Diff (`Mod+Alt+Shift+D`). Then Git › Next Change (`Alt+Shift+]`) and Previous Change (`Alt+Shift+[`). | A "Diff: README.md" tab shows the staged version left (the committed one, since nothing is staged) and your copy right, with the new lines highlighted. Next/Previous move the cursor between changed chunks, wrapping. Typing on the right edits the file. | [ ] | [ ] | | 5.3 | Changes: `Mod+Alt+Shift+G`. | The Changes tab: Changes with `Checkout.php`, `InMemoryProductRepository.php`, `ProductRepository.php`, `README.md`; Untracked with `notes.txt`. Double-click on a file opens its diff. | [ ] | [ ] | | 5.4 | Tick the checkbox of the Changes group (or select a row and press Space), leave `notes.txt` untracked. `Mod+Alt+Shift+M`, type `Rename findBySku and fix the preview`, `Mod+Enter`. | The files move to Staged, then the commit runs; a toast says "Committed : Rename findBySku…". The gutter bars and file colours go away; only `notes.txt` is left. | [ ] | [ ] | | 5.4b | In the Changes tab, right-click `notes.txt` › Add to .gitignore. | A toast "Added to .gitignore: notes.txt"; `notes.txt` leaves Untracked and turns the ignored colour in the tree; `.gitignore` shows as changed. | [ ] | [ ] | -| 5.5 | Amend: tick "Amend" with an empty message box. Edit the text to `Rename findBySku to findProduct and fix the preview`, Commit. | The box fills with the last commit's message when you tick Amend. The commit is replaced (the log in 5.6 shows only the new text). | [ ] | [ ] | -| 5.6 | Git › Log. | The Log tab draws a graph: `feature/customer` branching off and merged back, `feature/discounts` branching off, badges for `HEAD`, `main`, `origin/main`, `v0.1.0`, `origin/release/1.0`. Authors Ada Lindqvist, Ben Okafor, Cleo Marchetti, dated 2024–2026. Selecting a commit shows its message and files on the right; double-clicking a file opens its diff at that commit (read-only). | [ ] | [ ] | +| 5.5 | Amend: tick `.gitignore` in Changes (so the amend takes it along), then tick "Amend" with an empty message box. Edit the text to `Rename findBySku to findProduct and fix the preview`, Commit. | The box fills with the last commit's message when you tick Amend. The commit is replaced (the log in 5.6 shows only the new text). | [ ] | [ ] | +| 5.6 | Git › Log. | The Log tab draws a graph: `feature/customer` branching off and merged back, `feature/discounts` branching off, badges for `HEAD`, `main`, `origin/main`, `v0.1.0`, `origin/release/1.0`. Authors Ada Lindqvist, Ben Okafor, Cleo Marchetti, dated 2024–2026, and "Lutra Tester" (the demo's Git user) on your own commits. Selecting a commit shows its message and files on the right; double-clicking a file opens its diff at that commit (read-only). | [ ] | [ ] | | 5.7 | Type `price` in the message filter; then clear it. | Only commits whose message contains "price" are listed (without a graph), then all again. | [ ] | [ ] | | 5.8 | Right-click `src/Service/PriceCalculator.php` in the tree › Show History. | The Log shows "History of src/Service/PriceCalculator.php": "Round gross prices to cents" and "Add price calculator and price formatting". The chip's × clears it. | [ ] | [ ] | -| 5.9 | Open `PriceCalculator.php`, Git › Annotate with Git Blame. | A gutter with date and author per run of lines: Ben Okafor (2026-08-14) on the `round(...)` line, Cleo Marchetti (2025-06-02) on most others; newer lines have a stronger bar. Hovering an annotation shows the commit; a click selects it in the Log. Running the command again hides the gutter. | [ ] | [ ] | +| 5.9 | Open `PriceCalculator.php`, Git › Annotate with Git Blame. | A gutter with date and author per run of lines: Ben Okafor (2026-08-14) on the `round(...)` line and the "rounded to cents" doc line, Cleo Marchetti (2025-06-02) on most others; newer lines have a stronger bar. Hovering an annotation shows the commit; a click selects it in the Log. Running the command again hides the gutter. | [ ] | [ ] | | 5.10 | Git › Fetch. | A toast says the fetch is done; the status bar shows `↑1 ↓1` (your commit, the changelog commit). | [ ] | [ ] | | 5.11 | Git › Pull. | A toast says the pull is done; `CHANGELOG.md` appears in the tree; the status bar shows `↑2` (your commit and the merge of the pull). | [ ] | [ ] | | 5.12 | Git › Push. | A toast says the push is done; the arrows disappear. In the terminal, `git --git-dir ../origin.git log --oneline -1` shows the pull's merge commit. | [ ] | [ ] | -| 5.13 | Click `main` in the status bar. | The branch popup: Local `feature/customer`, `feature/discounts`, `main` (checked, "current", upstream `origin/main`); Remote `origin/main`, `origin/release/1.0`. Typing filters. | [ ] | [ ] | +| 5.13 | Click `main` in the status bar. | The branch popup: Local `feature/customer`, `feature/discounts`, `main` (checked, "current"); Remote `origin/main`, `origin/release/1.0`. Typing filters. | [ ] | [ ] | | 5.14 | Choose `origin/release/1.0`. | A toast; the status bar says `release/1.0`; `CHANGELOG.md` and `public/` vanish from the tree; open tabs of changed files reload. | [ ] | [ ] | | 5.15 | Git › New Branch…, name `try/scratch`, "Check out" on, Create. Then switch back to `main` with the popup. | The status bar shows `try/scratch`, then `main` again, with `CHANGELOG.md` back. | [ ] | [ ] | | 5.16 | Change a line in `src/Model/Product.php`, save. Git › Stash Changes…, message `wip product`, Stash. | A toast; `Product.php` is back to its committed text (an open tab reloads). | [ ] | [ ] | @@ -112,7 +112,7 @@ Before this section: `DEMO/shop` has the changes from 1.3, 3.3 and 3.10. The dem | 5.19 | Git › Abort Merge…, confirm. | The merge is undone: `DiscountPolicy.php` is gone, no conflict colour, `main` as before. | [ ] | [ ] | | 5.20 | Git › Merge… `feature/discounts` again, then "Resolve…" on `PriceCalculator.php`. | Three editors: current branch (left), result (middle), merged branch (right), "1 of 1 conflicts open" (or more). | [ ] | [ ] | | 5.21 | "Accept all left". Then, in the middle editor, change `gross(float $net)` to `gross(float $net, float $discount = 0.0)` and `round($net *` to `round(max(0.0, $net - $discount) *`. "Apply and mark resolved". | Apply is enabled once no chunk is open; afterwards the file is saved and the list says no conflicts are left, offering "Commit…". | [ ] | [ ] | -| 5.22 | "Commit…". Keep the prefilled message, Commit. Then `php public/index.php` in the terminal. | The message box already holds `Merge branch 'feature/discounts'` (git's prepared message). The commit succeeds; the Log shows the merge with two parents; the script still prints `19.88 EUR`. | [ ] | [ ] | +| 5.22 | "Commit…". Keep the prefilled message, Commit. (The conflict warnings from 5.18 and 5.20 stay until you close them with ×; close them if they cover the Commit button.) Then `php public/index.php` in the terminal. | The message box already holds `Merge branch 'feature/discounts'` (git's prepared message). The commit succeeds; the Log shows the merge with two parents; the script still prints `19.88 EUR`. | [ ] | [ ] | | 5.23 | Git › Manage Remotes… Add a remote `backup` with the URL of `DEMO/origin.git`; then Remove it (confirm in the row). | `origin` is listed with its URL; `backup` appears and disappears again. | [ ] | [ ] | | 5.24 | Git › Clone Repository…, URL `DEMO/origin.git` (the full path), "Browse…" and choose `DEMO`. | The folder field becomes `DEMO/origin`. Clone shows progress, then the clone opens as the project (tree with `src`, `public`, `CHANGELOG.md`; branch `main`). | [ ] | [ ] | | 5.25 | File › Open Folder… `DEMO/shop`. | The demo project is back, with the Git state from 5.22. | [ ] | [ ] | @@ -187,3 +187,4 @@ When everything is ticked on both platforms, say so in the chat with the build c | Date | Change | Summary | |---|---|---| | 2026-10-31 | new | A2: the six alpha workflows as manual steps, the demo project (`cargo xtask demo-project`), failure reports | +| 2026-11-01 | dry run | C8 C1: corrected after a Windows dry run (release build, control channel, CLI, MCP): 1.15 line break, 2.4 namespace node, 3.4 line 43, 3.7 `round` instead of `format_price`, 3.9 declaration, 5.2 staged label, 5.5 amend takes `.gitignore` along (else 5.16 stashes it), 5.6 own commits' author, 5.9 doc line, 5.13 no upstream next to "current", 5.22 sticky conflict toasts | diff --git a/ui/src/components/find/FindToolWindow.vue b/ui/src/components/find/FindToolWindow.vue index 8b376d5..99b41c0 100644 --- a/ui/src/components/find/FindToolWindow.vue +++ b/ui/src/components/find/FindToolWindow.vue @@ -33,9 +33,22 @@ const list = ref(null); /** Rows moved by Page Up and Page Down. */ const PAGE = 10; +/** + * The match and file counts in words, singular for one. + * + * @param matches - number of matches. + * @param files - number of files. + */ +function countWords(matches: number, files: number): { matches: string; files: string } { + return { + matches: matches === 1 ? t("find.count.matches.one") : t("find.count.matches.other", { count: String(matches) }), + files: files === 1 ? t("find.count.files.one") : t("find.count.files.other", { count: String(files) }), + }; +} + /** The status line under the fields. */ const status = computed(() => { - const counts = { matches: String(find.matchCount), files: String(find.files.length) }; + const counts = countWords(find.matchCount, find.files.length); if (find.running) { return t("find.status.running", counts); } @@ -43,7 +56,7 @@ const status = computed(() => { if (!done) { return find.error === null ? t("find.status.idle") : ""; } - const totals = { matches: String(done.matches), files: String(done.files), ms: String(done.elapsedMs) }; + const totals = { ...countWords(done.matches, done.files), ms: String(done.elapsedMs) }; if (done.cancelled) { return t("find.status.cancelled", totals); } diff --git a/ui/src/i18n/en.json b/ui/src/i18n/en.json index fa67b5b..9383992 100644 --- a/ui/src/i18n/en.json +++ b/ui/src/i18n/en.json @@ -115,6 +115,10 @@ "editor.tabs.label": "Editor tabs", "editor.tabs.unsaved": "unsaved changes", "find.action.search": "Search", + "find.count.files.one": "1 file", + "find.count.files.other": "{count} files", + "find.count.matches.one": "1 match", + "find.count.matches.other": "{count} matches", "find.exclude.label": "Exclude files", "find.exclude.placeholder": "Exclude, e.g. *.min.js, var/**", "find.include.label": "Include files", @@ -125,11 +129,11 @@ "find.query.label": "Text to find", "find.query.placeholder": "Find in files", "find.results.label": "Search results", - "find.status.cancelled": "Cancelled · {matches} matches in {files} files", - "find.status.done": "{matches} matches in {files} files · {ms} ms", + "find.status.cancelled": "Cancelled · {matches} in {files}", + "find.status.done": "{matches} in {files} · {ms} ms", "find.status.idle": "Type a text and press Enter", "find.status.none": "No matches", - "find.status.running": "Searching… {matches} matches in {files} files", + "find.status.running": "Searching… {matches} in {files}", "find.status.truncated": "Stopped at {matches} matches; narrow the query or the files to see the rest", "find.toolWindow.title": "Find", "goto.empty.noMatches": "Nothing matches", diff --git a/ui/tests/find/FindToolWindow.test.ts b/ui/tests/find/FindToolWindow.test.ts index 2c18cc3..3c17fc3 100644 --- a/ui/tests/find/FindToolWindow.test.ts +++ b/ui/tests/find/FindToolWindow.test.ts @@ -373,6 +373,15 @@ describe("Find tool window", () => { expect(wrapper.find("[data-test=find-submit]").exists()).toBe(true); }); + it("uses the singular for one match and one file", async () => { + const { wrapper } = await mountFind(); + await searchFor(wrapper, "foo"); + await emit(results(7, "a.php", [[0, "[foo]"]])); + expect(wrapper.get("[data-test=find-status]").text()).toBe("Searching… 1 match in 1 file"); + await emit(done(7, { matches: 2, files: 1 })); + expect(wrapper.get("[data-test=find-status]").text()).toContain("2 matches in 1 file · "); + }); + it("says when nothing matched or the search was cancelled", async () => { const { wrapper } = await mountFind(); await searchFor(wrapper, "zzz");