diff --git a/packages/nx/src/native/tui/components/snapshots/nx__native__tui__components__tasks_list__tests__pinned_tasks_with_narrow_width.snap b/packages/nx/src/native/tui/components/snapshots/nx__native__tui__components__tasks_list__tests__pinned_tasks_with_narrow_width.snap new file mode 100644 index 0000000000..dedb352a85 --- /dev/null +++ b/packages/nx/src/native/tui/components/snapshots/nx__native__tui__components__tasks_list__tests__pinned_tasks_with_narrow_width.snap @@ -0,0 +1,19 @@ +--- +source: packages/nx/src/native/tui/components/tasks_list.rs +expression: terminal.backend() +--- +" " +" NX Running Test Task Duration" +" " +" " +"> · task1 [1] ..." +" · task2 ..." +" · task3 ..." +" " +" " +" " +" " +" " +" " +" " +" ← 1/1 → quit: q help: ?" diff --git a/packages/nx/src/native/tui/components/tasks_list.rs b/packages/nx/src/native/tui/components/tasks_list.rs index 693bb9994b..a90633d05c 100644 --- a/packages/nx/src/native/tui/components/tasks_list.rs +++ b/packages/nx/src/native/tui/components/tasks_list.rs @@ -1001,7 +1001,11 @@ impl TasksList { .enumerate() .filter_map(|(idx, task)| { if task.as_deref() == Some(task_name.as_str()) { - Some(format!("[Pinned output {}]", idx + 1)) + Some(if has_narrow_area_width { + format!("[{}]", idx + 1) + } else { + format!("[Pinned output {}]", idx + 1) + }) } else { None } @@ -2781,4 +2785,15 @@ mod tests { render_to_test_backend(&mut terminal, &mut tasks_list); insta::assert_snapshot!(terminal.backend()); } + + #[test] + fn test_pinned_tasks_with_narrow_width() { + let (mut tasks_list, test_tasks) = create_test_tasks_list(); + let mut terminal = create_test_terminal(40, 15); + + tasks_list.pin_task(test_tasks[0].id.clone(), 0); + + render_to_test_backend(&mut terminal, &mut tasks_list); + insta::assert_snapshot!(terminal.backend()); + } }