Commit c7419ca
committed
Fix: 'rows' variable initialization error in mouse event handler
Issue: When clicking on any row in the TUI, getting 'Cannot access rows before
initialization' error causing immediate exit with code 1. Root cause: rows was
declared as a local variable inside redraw(), but hitTestClick tried to access
it in the event loop where it didn't exist.
Fix: Declare rows as a persistent variable outside redraw() and update it on
each redraw() call. This makes rows available throughout the event loop.
Also fixed normalizeScrollOffset calls for wheel scroll to use correct signature:
normalizeScrollOffset(scrollOffset, rows, groups, viewportHeight).
Closes #173 (partial - fixes the crash, functionality preserved)1 parent 9607b27 commit c7419ca
1 file changed
Lines changed: 6 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
214 | 214 | | |
215 | 215 | | |
216 | 216 | | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
217 | 220 | | |
218 | 221 | | |
219 | 222 | | |
| |||
227 | 230 | | |
228 | 231 | | |
229 | 232 | | |
230 | | - | |
| 233 | + | |
231 | 234 | | |
232 | 235 | | |
233 | 236 | | |
| |||
296 | 299 | | |
297 | 300 | | |
298 | 301 | | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | | - | |
| 302 | + | |
307 | 303 | | |
308 | 304 | | |
309 | 305 | | |
310 | 306 | | |
311 | 307 | | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
317 | | - | |
318 | | - | |
319 | | - | |
| 308 | + | |
320 | 309 | | |
321 | 310 | | |
322 | 311 | | |
| |||
0 commit comments