gioser-graph: fix panic slicing multi-byte chars (á, ñ, etc)

- Use .chars().take(18) instead of byte slicing &node.name[..18]
  which panics on accented characters
This commit is contained in:
Sergio
2026-05-23 15:42:32 +00:00
parent fa2bedf851
commit 2588673caf
2 changed files with 3 additions and 2 deletions
Binary file not shown.
@@ -248,8 +248,9 @@ impl GraphWidget {
for (i, node) in self.nodes.iter().enumerate() {
let Some((cx, cy)) = positions.get(i).map(|(_, p)| *p) else { continue; };
let color = camino_color(&node.camino).to_string();
let label = if node.name.len() > 20 {
format!("{}", &node.name[..18])
let label = if node.name.chars().count() > 20 {
let cutoff: String = node.name.chars().take(18).collect();
format!("{}", cutoff)
} else {
node.name.clone()
};