Eventos de teclado: - Event, KeyEvent, KeyCode, KeyModifiers, KeyEventKind - Soporte para todas las teclas: caracteres, F1-F12, navegación, control - Modificadores: Ctrl, Alt, Shift, Super Eventos de ratón: - MouseEvent, MouseEventKind, MouseButton - Click, release, drag, scroll (up/down/left/right) - Posición (column, row) con modificadores - Protocolos: SGR extended y X10 legacy Parser de escape sequences: - CSI sequences (arrows, F-keys, navigation) - SS3 sequences (F1-F4 alternativo) - SGR mouse protocol (mejores coordenadas) - X10 mouse protocol (compatibilidad) - Focus events, bracketed paste Cursor control: - Visibility: show/hide - Blinking: enable/disable - Styles: block, underline, bar (blinking/steady) - Position: moveTo, moveUp/Down/Left/Right - Save/restore position Terminal integrado: - pollEvent(timeout_ms) - polling con timeout - readEvent() - blocking read - enableMouseCapture/disableMouseCapture - enableFocusChange/disableFocusChange - enableBracketedPaste/disableBracketedPaste Ejemplo interactivo: - examples/events_demo.zig Tests: 47 (29 nuevos para eventos y cursor) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
64 lines
2 KiB
Zig
64 lines
2 KiB
Zig
const std = @import("std");
|
|
|
|
pub fn build(b: *std.Build) void {
|
|
const target = b.standardTargetOptions(.{});
|
|
const optimize = b.standardOptimizeOption(.{});
|
|
|
|
// Módulo de la librería
|
|
const zcatui_mod = b.createModule(.{
|
|
.root_source_file = b.path("src/root.zig"),
|
|
.target = target,
|
|
.optimize = optimize,
|
|
});
|
|
|
|
// Tests
|
|
const unit_tests = b.addTest(.{
|
|
.root_module = b.createModule(.{
|
|
.root_source_file = b.path("src/root.zig"),
|
|
.target = target,
|
|
.optimize = optimize,
|
|
}),
|
|
});
|
|
|
|
const run_unit_tests = b.addRunArtifact(unit_tests);
|
|
const test_step = b.step("test", "Ejecutar tests");
|
|
test_step.dependOn(&run_unit_tests.step);
|
|
|
|
// Ejemplo: hello
|
|
const hello_exe = b.addExecutable(.{
|
|
.name = "hello",
|
|
.root_module = b.createModule(.{
|
|
.root_source_file = b.path("examples/hello.zig"),
|
|
.target = target,
|
|
.optimize = optimize,
|
|
.imports = &.{
|
|
.{ .name = "zcatui", .module = zcatui_mod },
|
|
},
|
|
}),
|
|
});
|
|
b.installArtifact(hello_exe);
|
|
|
|
const run_hello = b.addRunArtifact(hello_exe);
|
|
run_hello.step.dependOn(b.getInstallStep());
|
|
const hello_step = b.step("hello", "Ejecutar ejemplo hello");
|
|
hello_step.dependOn(&run_hello.step);
|
|
|
|
// Ejemplo: events_demo
|
|
const events_demo_exe = b.addExecutable(.{
|
|
.name = "events-demo",
|
|
.root_module = b.createModule(.{
|
|
.root_source_file = b.path("examples/events_demo.zig"),
|
|
.target = target,
|
|
.optimize = optimize,
|
|
.imports = &.{
|
|
.{ .name = "zcatui", .module = zcatui_mod },
|
|
},
|
|
}),
|
|
});
|
|
b.installArtifact(events_demo_exe);
|
|
|
|
const run_events_demo = b.addRunArtifact(events_demo_exe);
|
|
run_events_demo.step.dependOn(b.getInstallStep());
|
|
const events_demo_step = b.step("events-demo", "Run events demo");
|
|
events_demo_step.dependOn(&run_events_demo.step);
|
|
}
|