Shader Packs page: show the first line of a pack's error

Translator errors go on with a drawn source excerpt that the row can't show.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ludovic Marie
2026-10-22 03:27:28 +02:00
parent 6ea7a51ff3
commit ac25d41578
@@ -103,8 +103,11 @@ impl Game<'_> {
}
fn shader_pack_error(&mut self, id: &str, error: &str) {
log::warn!("Horizon: shader pack {id}: {error}");
// The Shader Packs page says why on the pack's row.
self.ui.options.shader_pack_error = Some((id.to_owned(), error.to_owned()));
// The Shader Packs page says why on the pack's row: the first line,
// since translator errors go on with a drawn source excerpt.
let first = error.lines().map(str::trim).find(|l| !l.is_empty());
self.ui.options.shader_pack_error =
Some((id.to_owned(), first.unwrap_or(error).to_owned()));
self.system_message(Text::literal(format!("Shader pack {id}: {error}")));
}
}