Review engine and dropped files: fixes after the independent check
- The probe turns down an engine not called «Stockfish 19» right after `uci`, without a search; a search has a 10 s guard, the probe 30 s; probes stop and their engines quit (or are killed) when the program quits. Play engines (Rodent, Maia) are never candidates. - «Did not start» is its own outcome, said once and tried again next time; verdicts are kept for the real file with the reference's key; the engine's name is checked again when a job starts (a wrapper may run another program). - The wait for a probe belongs to its game or preparation; the game analysis and the opening errors wait apart; «analyse anew» keeps its `full`. - The offer says why: another engine (settings / system), a Stockfish 19 that calculates otherwise, one that did not start; the size line is back. - Dropped files: missing ones told, known ChessBase parts only, duplicates by the real file, each folder listed once; drops never replace a database being chosen again, a cancelled «Choose again» ends it; «Added to the shelf» over a game; a framed highlight with a card; long names shortened. - decisions.md: where dropping works (not in a Wayland session: winit 0.30). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
4fc1d5b67d
commit
829bde9fdb
14 changed files with 1164 additions and 334 deletions
|
|
@ -138,3 +138,28 @@ pub fn icon_button(ui: &mut Ui, check: bool, primary: bool) -> egui::Response {
|
|||
}
|
||||
resp
|
||||
}
|
||||
|
||||
/// `text` cut to `max` characters, with «…» in the middle when longer (a file's or an
|
||||
/// engine's name keeps its start and its end, where versions and extensions are).
|
||||
pub fn shorten(text: &str, max: usize) -> String {
|
||||
let n = text.chars().count();
|
||||
if n <= max || max < 3 {
|
||||
return text.to_owned();
|
||||
}
|
||||
let head = (max - 1) / 2;
|
||||
let tail = max - 1 - head;
|
||||
let start: String = text.chars().take(head).collect();
|
||||
let end: String = text.chars().skip(n - tail).collect();
|
||||
format!("{start}…{end}")
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod shorten_tests {
|
||||
#[test]
|
||||
fn long_names_are_cut_in_the_middle() {
|
||||
assert_eq!(super::shorten("Stockfish 19", 48), "Stockfish 19");
|
||||
assert_eq!(super::shorten("abcdefghij", 5), "ab…ij");
|
||||
assert_eq!(super::shorten("абвгдежзик", 7), "абв…зик");
|
||||
assert_eq!(super::shorten("abcdefghij", 7).chars().count(), 7);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue