feat(claudbg-wxdt): left-truncate project path in TUI session list

Pass project_max directly to truncate_project instead of project_max+30,
so the function (not ratatui's right-clip) controls truncation — showing
the end of the path (e.g. …/foo/bar) rather than the beginning.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
main
Elijah Voigt 2 months ago
parent 590e9e209e
commit 9abd18ab45

@ -73,12 +73,13 @@ pub fn render_session_list(f: &mut Frame, area: Rect, state: &AppState) {
// Compute the max width available for the project column so we can truncate. // Compute the max width available for the project column so we can truncate.
// Fixed widths: 8+20+20+6+7 = 61, plus 5 separators = 66, plus 2 borders = 68. // Fixed widths: 8+20+20+6+7 = 61, plus 5 separators = 66, plus 2 borders = 68.
// Use 30 chars as a safe default; the Min constraint will expand it. // Use 10 chars as a minimum; the Min constraint will expand it.
// We pass this exact value to truncate_project so it left-truncates before
// ratatui ever sees the string — ensuring the *end* of the path is shown.
let project_max: usize = table_area let project_max: usize = table_area
.width .width
.saturating_sub(68) // subtract fixed columns + separators + borders .saturating_sub(68) // subtract fixed columns + separators + borders
.max(10) as usize; .max(10) as usize;
let project_display_max = project_max + 30; // generous — actual render clips
// Apply active filter to the session rows. // Apply active filter to the session rows.
let active_filter = Filter::parse(&state.filter_active).ok(); let active_filter = Filter::parse(&state.filter_active).ok();
@ -96,7 +97,7 @@ pub fn render_session_list(f: &mut Frame, area: Rect, state: &AppState) {
let rows: Vec<Row> = filtered_sessions let rows: Vec<Row> = filtered_sessions
.iter() .iter()
.map(|s| { .map(|s| {
let project = truncate_project(&s.project, project_display_max); let project = truncate_project(&s.project, project_max);
Row::new(vec![ Row::new(vec![
s.short_id.clone(), s.short_id.clone(),
s.date.clone(), s.date.clone(),

Loading…
Cancel
Save