locateText method
Finds the terminal coordinates of text in the ANSI-stripped rendered
output. Returns null if not found.
This is the primary way to locate a widget for tapping when using hit-test-based dispatch — no zone IDs needed.
Implementation
({int x, int y})? locateText(String text) {
final lines = _lastView.split('\n');
for (var row = 0; row < lines.length; row++) {
final stripped = Layout.stripAnsi(lines[row]);
final col = stripped.indexOf(text);
if (col >= 0) {
return (x: col, y: row);
}
}
return null;
}