Compare commits

...

3 commits

Author SHA1 Message Date
R.Eugenio
ab39830477 Añadir /init optimizado (lee NORMAS_ESENCIALES + teamdocs)
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-23 13:28:54 +01:00
R.Eugenio
edba1cc7e5 fix(virtual_list): Soportar key repeat con navKeyPressed
Cambiar de keyPressed() a navKeyPressed() permite que mantener
pulsada la flecha arriba/abajo mueva la selección continuamente.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-23 13:12:54 +01:00
R.Eugenio
206a997628 fix(virtual_list): Usar Style.Color y Command.rect
- VirtualListConfig.Colors ahora usa Style.Color en vez de u32
- Reemplazar Command.fill() por Command.rect() (fill no existe)
- Corregir tipo bg_color en drawRows

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-23 13:00:20 +01:00
4 changed files with 42 additions and 29 deletions

8
.claude/commands/init.md Normal file
View file

@ -0,0 +1,8 @@
Protocolo de inicio - Lee estos archivos EN PARALELO:
1. CLAUDE.md (contexto de este proyecto específico)
2. /mnt/cello2/arno/re/recode/teamdocs/NORMAS_ESENCIALES.md (normas de trabajo, rutas, compilación)
3. /mnt/cello2/arno/re/recode/teamdocs/LAST_UPDATE.md (cambios recientes del equipo)
4. /mnt/cello2/arno/re/recode/teamdocs/agenda/2025-12_diciembre.md (trabajo del mes)
Después de leer, confirma brevemente qué sabes del proyecto y pregunta en qué puedes ayudar.

5
.gitignore vendored
View file

@ -11,3 +11,8 @@ zig-out/
# OS
.DS_Store
Thumbs.db
# Claude Code settings (ignorar), pero commands se versionan
.claude/settings*.json
.claude/*.json
!.claude/commands/

View file

@ -4,6 +4,7 @@
//! fuente de datos (WHO, DOC, etc.)
const std = @import("std");
const Style = @import("../../core/style.zig");
/// Dirección de ordenación
pub const SortDirection = enum {
@ -125,15 +126,15 @@ pub const VirtualListConfig = struct {
colors: ?Colors = null,
pub const Colors = struct {
background: u32 = 0xFFFFFFFF,
header_background: u32 = 0xFFE0E0E0,
row_normal: u32 = 0xFFFFFFFF,
row_alternate: u32 = 0xFFF8F8F8,
row_selected: u32 = 0xFF0078D4,
row_selected_unfocus: u32 = 0xFFD0D0D0,
text: u32 = 0xFF000000,
text_selected: u32 = 0xFFFFFFFF,
border: u32 = 0xFFCCCCCC,
background: Style.Color = Style.Color.rgb(255, 255, 255),
header_background: Style.Color = Style.Color.rgb(224, 224, 224),
row_normal: Style.Color = Style.Color.rgb(255, 255, 255),
row_alternate: Style.Color = Style.Color.rgb(248, 248, 248),
row_selected: Style.Color = Style.Color.rgb(0, 120, 212),
row_selected_unfocus: Style.Color = Style.Color.rgb(208, 208, 208),
text: Style.Color = Style.Color.rgb(0, 0, 0),
text_selected: Style.Color = Style.Color.rgb(255, 255, 255),
border: Style.Color = Style.Color.rgb(204, 204, 204),
};
};

View file

@ -245,7 +245,7 @@ fn drawHeader(
const header_h = config.row_height;
// Header background
ctx.pushCommand(Command.fill(
ctx.pushCommand(Command.rect(
bounds.x,
bounds.y,
bounds.w,
@ -291,11 +291,11 @@ fn drawHeader(
// Column separator
x += @as(i32, @intCast(col.width));
ctx.pushCommand(Command.fill(x - 1, bounds.y, 1, header_h, colors.border));
ctx.pushCommand(Command.rect(x - 1, bounds.y, 1, header_h, colors.border));
}
// Bottom border
ctx.pushCommand(Command.fill(
ctx.pushCommand(Command.rect(
bounds.x,
bounds.y + @as(i32, @intCast(header_h)) - 1,
bounds.w,
@ -332,7 +332,7 @@ fn drawRows(
const is_selected = list_state.selected_id != null and row.id == list_state.selected_id.?;
const is_alternate = global_idx % 2 == 1;
const bg_color: u32 = if (is_selected)
const bg_color: Style.Color = if (is_selected)
if (list_state.has_focus) colors.row_selected else colors.row_selected_unfocus
else if (is_alternate)
colors.row_alternate
@ -340,7 +340,7 @@ fn drawRows(
colors.row_normal;
// Row background
ctx.pushCommand(Command.fill(
ctx.pushCommand(Command.rect(
content_bounds.x,
row_y,
content_bounds.w,
@ -380,7 +380,7 @@ fn drawFooter(
list_state: *VirtualListState,
) void {
// Background
ctx.pushCommand(Command.fill(
ctx.pushCommand(Command.rect(
bounds.x,
bounds.y,
bounds.w,
@ -435,7 +435,7 @@ fn drawScrollbar(
// Scrollbar track
const track_x = bounds.x + @as(i32, @intCast(bounds.w - scrollbar_w));
const track_y = bounds.y + @as(i32, @intCast(header_h));
ctx.pushCommand(Command.fill(track_x, track_y, scrollbar_w, content_h, colors.row_alternate));
ctx.pushCommand(Command.rect(track_x, track_y, scrollbar_w, content_h, colors.row_alternate));
// Thumb size and position
const visible_ratio = @as(f32, @floatFromInt(visible_rows)) / @as(f32, @floatFromInt(total_rows));
@ -446,7 +446,7 @@ fn drawScrollbar(
const thumb_y = track_y + @as(i32, @intFromFloat(scroll_ratio * @as(f32, @floatFromInt(content_h - thumb_h))));
// Draw thumb
ctx.pushCommand(Command.fill(track_x + 2, thumb_y, scrollbar_w - 4, thumb_h, colors.border));
ctx.pushCommand(Command.rect(track_x + 2, thumb_y, scrollbar_w - 4, thumb_h, colors.border));
}
// =============================================================================
@ -464,18 +464,17 @@ fn handleKeyboard(
_ = provider;
_ = result;
if (ctx.input.keyPressed(.up)) {
list_state.moveUp();
} else if (ctx.input.keyPressed(.down)) {
list_state.moveDown(visible_rows);
} else if (ctx.input.keyPressed(.page_up)) {
list_state.pageUp(visible_rows);
} else if (ctx.input.keyPressed(.page_down)) {
list_state.pageDown(visible_rows, total_rows);
} else if (ctx.input.keyPressed(.home)) {
list_state.goToStart();
} else if (ctx.input.keyPressed(.end)) {
list_state.goToEnd(visible_rows, total_rows);
// Usar navKeyPressed() para soportar key repeat (tecla mantenida pulsada)
if (ctx.input.navKeyPressed()) |key| {
switch (key) {
.up => list_state.moveUp(),
.down => list_state.moveDown(visible_rows),
.page_up => list_state.pageUp(visible_rows),
.page_down => list_state.pageDown(visible_rows, total_rows),
.home => list_state.goToStart(),
.end => list_state.goToEnd(visible_rows, total_rows),
else => {},
}
}
}