From 0f3edebcb3f743dd1c15d7eea63ca78cd02376d9 Mon Sep 17 00:00:00 2001 From: ProofOfConcept Date: Thu, 19 Mar 2026 00:47:46 -0400 Subject: [PATCH] tui: handle empty cells in cursor scan When scanning the buffer for cursor position, also check empty cells. The cursor might be positioned at an empty cell (e.g., end of line or after all visible characters). --- poc-agent/src/tui.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/poc-agent/src/tui.rs b/poc-agent/src/tui.rs index 0507068..a616dd3 100644 --- a/poc-agent/src/tui.rs +++ b/poc-agent/src/tui.rs @@ -838,12 +838,17 @@ impl App { // Count visible characters (skip zero-width and empty) if !symbol.is_empty() { if char_count == cursor_char_pos { - // Found the cursor position + // Found the cursor position - this is where the next char would go cursor_x = x; cursor_y = y; break; } char_count += 1; + } else if char_count == cursor_char_pos { + // Empty cell but we've reached the cursor position + cursor_x = x; + cursor_y = y; + break; } } }