Problem / Background
src/ui/renderers/vgpu_renderer.rs and src/ui/renderers/mig_renderer.rs both contain byte-identical private truncate_str functions that truncate a string to a max character count with an ellipsis suffix. This duplication increases maintenance risk -- a bug fix or behavior change in one copy may not be applied to the other.
Goal
Extract the shared truncate_str function into a common module (e.g., src/ui/renderers/mod.rs or a shared src/ui/utils.rs) and have both renderers import it.
Scope
- Move
truncate_str to a shared location
- Update both
vgpu_renderer.rs and mig_renderer.rs to use the shared version
- Ensure existing tests continue to pass
Problem / Background
src/ui/renderers/vgpu_renderer.rsandsrc/ui/renderers/mig_renderer.rsboth contain byte-identical privatetruncate_strfunctions that truncate a string to a max character count with an ellipsis suffix. This duplication increases maintenance risk -- a bug fix or behavior change in one copy may not be applied to the other.Goal
Extract the shared
truncate_strfunction into a common module (e.g.,src/ui/renderers/mod.rsor a sharedsrc/ui/utils.rs) and have both renderers import it.Scope
truncate_strto a shared locationvgpu_renderer.rsandmig_renderer.rsto use the shared version