From 7bc7ee9898ead765d32ed3cec7e3d38e0c594639 Mon Sep 17 00:00:00 2001 From: Chris Hendrickson Date: Sat, 25 Apr 2026 13:40:28 -0400 Subject: [PATCH] fix(tui): keep highlight on moved ticket in destination column After < or > move, find the ticket's index in the destination column's filtered list via indexWhere instead of jumping to nt.length - 1. indexWhere returns -1 if not found (e.g. filtered out), max(0,...) clamps that safely to the first position. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- packages/kanban/lib/src/commands/tui_command.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/kanban/lib/src/commands/tui_command.dart b/packages/kanban/lib/src/commands/tui_command.dart index 58ac617..dd12948 100644 --- a/packages/kanban/lib/src/commands/tui_command.dart +++ b/packages/kanban/lib/src/commands/tui_command.dart @@ -417,7 +417,7 @@ class TuiCommand extends DewCommand { byColumn = _groupByColumn(tickets, config); colIdx--; final nt = _filtered(byColumn[newColId] ?? [], searchQuery); - ticketIdx = max(0, nt.length - 1); + ticketIdx = max(0, nt.indexWhere((x) => x.id == t.id)); statusMsg = 'Moved ${t.id} → ${config.columns[colIdx].name}'; } on ArgumentError catch (e) { statusMsg = 'Error: ${e.message ?? e}'; @@ -433,7 +433,7 @@ class TuiCommand extends DewCommand { byColumn = _groupByColumn(tickets, config); colIdx++; final nt = _filtered(byColumn[newColId] ?? [], searchQuery); - ticketIdx = max(0, nt.length - 1); + ticketIdx = max(0, nt.indexWhere((x) => x.id == t.id)); statusMsg = 'Moved ${t.id} → ${config.columns[colIdx].name}'; } on ArgumentError catch (e) { statusMsg = 'Error: ${e.message ?? e}';