fix(virtual_list): Scroll en última fila y posición correcta
- moveDown: Calcular screen position antes de decidir scroll - Scroll ahora ocurre cuando llega a última fila visible (no penúltima) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
b9e7434ef7
commit
ae993a0f6f
1 changed files with 7 additions and 2 deletions
|
|
@ -219,8 +219,13 @@ pub const VirtualListState = struct {
|
|||
if (window_idx + 1 < self.current_window.len) {
|
||||
self.selectByWindowIndex(window_idx + 1);
|
||||
|
||||
// Si la nueva selección está cerca del final visible, scroll
|
||||
if (window_idx + 1 >= visible_rows - 1) {
|
||||
// Calcular posición en pantalla de la nueva selección
|
||||
const window_offset = self.scroll_offset -| self.window_start;
|
||||
const new_screen_pos = (window_idx + 1) -| window_offset;
|
||||
|
||||
// Scroll cuando la nueva posición llega a la ÚLTIMA fila visible
|
||||
// (visible_rows - 1 es el índice de la última fila, 0-indexed)
|
||||
if (new_screen_pos >= visible_rows) {
|
||||
self.scroll_offset += 1;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue