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.
This commit is contained in:
ProofOfConcept 2026-03-19 00:48:52 -04:00
parent 0f3edebcb3
commit 2e3943b89f

View file

@ -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;
}
}