fix(virtual_list): Scroll arriba + footer compacto
- moveUp: Calcular screen position para scroll correcto - footer_h: Reducir de 20 a 16 pixels para más filas visibles 🤖 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
ae993a0f6f
commit
b2bcdeae1a
2 changed files with 19 additions and 5 deletions
|
|
@ -200,16 +200,30 @@ pub const VirtualListState = struct {
|
|||
|
||||
/// Mueve la selección hacia arriba
|
||||
pub fn moveUp(self: *Self) void {
|
||||
const window_offset = self.scroll_offset -| self.window_start;
|
||||
|
||||
if (self.findSelectedInWindow()) |window_idx| {
|
||||
// Calcular posición en pantalla actual
|
||||
const screen_pos = window_idx -| window_offset;
|
||||
|
||||
if (window_idx > 0) {
|
||||
// Hay item anterior en buffer, seleccionarlo
|
||||
self.selectByWindowIndex(window_idx - 1);
|
||||
} else if (self.window_start > 0) {
|
||||
// Necesita scroll up - el widget debe manejar esto
|
||||
self.scroll_offset = if (self.scroll_offset > 0) self.scroll_offset - 1 else 0;
|
||||
|
||||
// Si estábamos en la primera fila visible, hacer scroll
|
||||
if (screen_pos == 0 and self.scroll_offset > 0) {
|
||||
self.scroll_offset -= 1;
|
||||
}
|
||||
} else {
|
||||
// Estamos en el inicio del buffer
|
||||
// Scroll up para cargar más datos (si es posible)
|
||||
if (self.scroll_offset > 0) {
|
||||
self.scroll_offset -= 1;
|
||||
}
|
||||
}
|
||||
} else if (self.current_window.len > 0) {
|
||||
// Sin selección: seleccionar primera fila visible
|
||||
self.selectByWindowIndex(0);
|
||||
self.selectByWindowIndex(window_offset);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ pub fn virtualListRect(
|
|||
|
||||
// Calculate dimensions
|
||||
const header_h: u32 = config.row_height;
|
||||
const footer_h: u32 = if (config.show_count) 20 else 0;
|
||||
const footer_h: u32 = if (config.show_count) 16 else 0; // 16px para footer compacto
|
||||
const content_h = bounds.h -| header_h -| footer_h;
|
||||
const visible_rows: usize = @intCast(content_h / config.row_height);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue