feat: GPU-Nummer im Chip-Symbol statt als Text daneben (#1108); Version 0.1.17-rc2

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GmHhg6sxZ8wsKZAVLQ6Xj5
This commit is contained in:
2026-11-21 20:20:26 +01:00
parent 8670f59e55
commit 0673dc6c00
9 changed files with 59 additions and 11 deletions

View File

@ -1291,6 +1291,7 @@ pre.befehl{margin:0;padding:.6rem .8rem;background:var(--bg);border:1px solid va
.fsym{--k:var(--muted);width:1.7rem;height:1.7rem;box-sizing:border-box;padding:.27rem;margin-right:.3rem;vertical-align:middle;border-radius:.45rem;fill:none;stroke:var(--k);stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
td.faehig{white-space:nowrap}.fenster{display:inline-flex;vertical-align:middle;margin-left:.3rem}.fkann{display:inline-flex;align-items:center;gap:.1rem;margin:0 .6rem .3rem 0;white-space:nowrap}.fsym.k-chat{--k:var(--info)}.fsym.k-vision{--k:var(--accent-strong)}.fsym.k-tools{--k:var(--cat-2)}.fsym.k-embed{--k:var(--ok)}.fsym.k-stream{--k:var(--cat-1)}.fsym.k-completion{--k:var(--cat-3)}.fsym.k-speech{--k:var(--warn)}.fsym.k-think{--k:var(--cat-2)}.fsym.z-ok{--k:var(--ok)}.fsym.z-warn{--k:var(--warn)}.fsym.z-aus{--k:var(--muted)}.z-fehler{--k:var(--danger)}.fehlertext{color:var(--danger);display:block;white-space:normal;max-width:28rem;overflow-wrap:anywhere}
.fsym.gemeldet,.fsym.datei{background:color-mix(in srgb,var(--k) 22%,transparent);border:1px solid color-mix(in srgb,var(--k) 55%,transparent)}
.fsym.gpusym{--k:var(--text);width:2.1rem;height:2.1rem;padding:.12rem;background:transparent;border:1px solid color-mix(in srgb,var(--text) 35%,transparent)}.fsym.gpusym text{fill:var(--text);stroke:none;font-family:inherit}
.fsym.engine{background:transparent;border:1px dashed color-mix(in srgb,var(--k) 55%,transparent);opacity:.75}
footer label{display:inline-flex;gap:.35rem;align-items:center}footer select{padding:.15rem .4rem;font-size:.8rem}
.tabellenleiste{display:flex;flex-wrap:wrap;gap:.5rem .7rem;align-items:center;margin:0 0 .7rem}.tabellenleiste input[type=search]{min-width:12rem}

View File

@ -262,14 +262,17 @@ pub(super) fn freigabe(enabled: bool) -> String {
)
}
/// GPU-Nummern („0, 1“) als Chip-Symbole mit Nummer.
/// GPU-Nummern („0, 1“) als Chip-Symbole; die Nummer steht **im** Symbol, daneben kein Text (#1108). Alle in
/// derselben Farbe: Die Nummer unterscheidet die Karten, Farbe allein trägt keine Information.
pub(super) fn gpu_symbole(gpus: &str) -> String {
gpus.split(',')
.map(str::trim)
.filter(|n| !n.is_empty())
.map(|n| {
// Zwei Stellen brauchen eine kleinere Schrift, damit die Nummer im Chip bleibt.
let groesse = if n.chars().count() > 1 { "10" } else { "13" };
format!(
"<span class=\"fkann\" title=\"GPU {n}\"><svg class=\"fsym engine k-embed\" viewBox=\"0 0 24 24\" role=\"img\" aria-label=\"GPU {n}\"><path d=\"M12 20v2\"/><path d=\"M12 2v2\"/><path d=\"M17 20v2\"/><path d=\"M17 2v2\"/><path d=\"M2 12h2\"/><path d=\"M2 17h2\"/><path d=\"M2 7h2\"/><path d=\"M20 12h2\"/><path d=\"M20 17h2\"/><path d=\"M20 7h2\"/><path d=\"M7 20v2\"/><path d=\"M7 2v2\"/><rect x=\"4\" y=\"4\" width=\"16\" height=\"16\" rx=\"2\"/><rect x=\"8\" y=\"8\" width=\"8\" height=\"8\" rx=\"1\"/></svg>{n}</span>",
"<span class=\"fkann\" title=\"GPU {n}\"><svg class=\"fsym gpusym\" viewBox=\"0 0 24 24\" role=\"img\" aria-label=\"GPU {n}\"><path d=\"M12 20v2\"/><path d=\"M12 2v2\"/><path d=\"M17 20v2\"/><path d=\"M17 2v2\"/><path d=\"M2 12h2\"/><path d=\"M2 17h2\"/><path d=\"M2 7h2\"/><path d=\"M20 12h2\"/><path d=\"M20 17h2\"/><path d=\"M20 7h2\"/><path d=\"M7 20v2\"/><path d=\"M7 2v2\"/><rect x=\"4\" y=\"4\" width=\"16\" height=\"16\" rx=\"2\"/><text x=\"12\" y=\"12.2\" text-anchor=\"middle\" dominant-baseline=\"central\" font-size=\"{groesse}\" font-weight=\"700\">{n}</text></svg></span>",
n = esc(n)
)
})
@ -323,6 +326,21 @@ pub(super) fn engine_faehigkeiten(caps: &Capabilities) -> String {
mod tests {
use super::*;
#[test]
fn gpu_nummer_steht_im_symbol_und_nicht_daneben() {
// #1108: Die Nummer ist Text im SVG, nach dem Symbol folgt kein weiterer Text.
let html = gpu_symbole("0, 1");
assert_eq!(html.matches("<svg").count(), 2, "{html}");
assert!(html.contains(">0</text></svg></span>"), "{html}");
assert!(html.contains(">1</text></svg></span>"), "{html}");
assert!(!html.contains("</svg>0"), "{html}");
assert!(!html.contains("k-embed"), "eine Farbe für alle: {html}");
assert!(html.contains("aria-label=\"GPU 1\""), "{html}");
// Zwei Stellen: kleinere Schrift; leere Angabe: nichts.
assert!(gpu_symbole("12").contains("font-size=\"10\""));
assert_eq!(gpu_symbole(" "), "");
}
fn caps(
chat: bool,
images: bool,