From 2e3943b89f64eae9a718d7fa98b081b831f8e4c0 Mon Sep 17 00:00:00 2001 From: ProofOfConcept Date: Thu, 19 Mar 2026 00:48:52 -0400 Subject: [PATCH] tui: use explicit found flag for cursor scan Clean up the break logic by using an explicit flag instead of checking cursor_x/cursor_y values. --- poc-agent/src/tui.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/poc-agent/src/tui.rs b/poc-agent/src/tui.rs index a616dd3..88b095f 100644 --- a/poc-agent/src/tui.rs +++ b/poc-agent/src/tui.rs @@ -829,6 +829,7 @@ impl App { let mut char_count = 0usize; let mut cursor_x = input_area.x; let mut cursor_y = input_area.y; + let mut found = false; // Walk through the rendered buffer, counting characters until we reach the cursor position for y in input_area.y..input_area.y + input_area.height { @@ -841,6 +842,7 @@ impl App { // Found the cursor position - this is where the next char would go cursor_x = x; cursor_y = y; + found = true; break; } char_count += 1; @@ -848,12 +850,13 @@ impl App { // Empty cell but we've reached the cursor position cursor_x = x; cursor_y = y; + found = true; break; } } } - if cursor_x != input_area.x || cursor_y != input_area.y { - break; // Found it + if found { + break; } }