Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ Rotate: rename active file to architect-<UTC timestamp>.log and continue in new
| `session/*` (shell, pty, vt_stream, cwd) | Shell spawning, PTY abstraction, VT parsing, working directory detection | `spawn()`, `Pty`, `VtStream.processBytes()`, `getCwd()` | std (posix), ghostty-vt |
| `render/renderer.zig` | Scene rendering: terminals, borders, animations, terminal scrollbar painting | `render()`, `RenderCache`, per-session texture management | `font`, `font_cache`, `gfx/*`, `anim/easing`, `app/app_state`, `ui/components/scrollbar`, `c` |
| `font.zig` + `font_cache.zig` | Font rendering, HarfBuzz shaping, glyph LRU cache, shared font cache | `Font`, `openFont()`, `renderGlyph()`, `FontCache`, `getOrCreate()` | `font_paths`, `c` (SDL3_ttf) |
| `gfx/*` (box_drawing, primitives) | Procedural box-drawing characters (U+2500-U+257F), rounded/thick border helpers, filled circles, bezier arrow rendering | `renderBoxDrawing()`, `drawRoundedRect()`, `drawThickBorder()`, `fillCircle()`, `fillRoundedRect()`, `renderBezierArrow()` | `c` |
| `gfx/*` (box_drawing, primitives) | Procedural box-drawing characters (U+2500-U+257F), rounded/thick border helpers, bezier arrow rendering | `renderBoxDrawing()`, `drawRoundedRect()`, `drawThickBorder()`, `fillRoundedRect()`, `renderBezierArrow()` | `c` |
| `ui/root.zig` | UI component registry, z-index dispatch, action drain | `UiRoot`, `register()`, `handleEvent()`, `update()`, `render()`, `needsFrame()` | `ui/component`, `ui/types` |
| `ui/component.zig` | UI component vtable interface | `UiComponent`, `VTable` (handleEvent, update, render, hitTest, wantsFrame, deinit) | `ui/types`, `c` |
| `ui/types.zig` | Shared UI type definitions | `UiHost`, `UiAction`, `UiActionQueue`, `UiAssets`, `SessionUiInfo` | `app/app_state`, `colors`, `font`, `geom` |
Expand Down
8 changes: 0 additions & 8 deletions src/c.zig
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,6 @@ pub const SDL_SetTextureBlendMode = c_import.SDL_SetTextureBlendMode;
pub const SDL_SetTextureAlphaMod = c_import.SDL_SetTextureAlphaMod;
pub const SDL_SetRenderVSync = c_import.SDL_SetRenderVSync;
pub const SDL_RenderTexture = c_import.SDL_RenderTexture;
pub const SDL_RENDERER_ACCELERATED: c_import.Uint32 = if (@hasDecl(c_import, "SDL_RENDERER_ACCELERATED"))
c_import.SDL_RENDERER_ACCELERATED
else
0x0000_0002;
pub const SDL_RENDERER_PRESENTVSYNC: c_import.Uint32 = if (@hasDecl(c_import, "SDL_RENDERER_PRESENTVSYNC"))
c_import.SDL_RENDERER_PRESENTVSYNC
else
0x0000_0004;
pub const SDL_SetRenderDrawBlendMode = c_import.SDL_SetRenderDrawBlendMode;
pub const SDL_SetRenderClipRect = c_import.SDL_SetRenderClipRect;
pub const SDL_GetRenderClipRect = c_import.SDL_GetRenderClipRect;
Expand Down
13 changes: 0 additions & 13 deletions src/gfx/primitives.zig
Original file line number Diff line number Diff line change
Expand Up @@ -180,19 +180,6 @@ pub fn fillRoundedRect(renderer: *c.SDL_Renderer, rect: Rect, radius: c_int) voi
}
}

pub fn fillCircle(renderer: *c.SDL_Renderer, cx: f32, cy: f32, radius: f32) void {
const r_int: c_int = @intFromFloat(radius);
var dy: c_int = -r_int;
while (dy <= r_int) : (dy += 1) {
const dy_f: f32 = @floatFromInt(dy);
const dx_sq = radius * radius - dy_f * dy_f;
if (dx_sq > 0) {
const dx = @sqrt(dx_sq);
_ = c.SDL_RenderLine(renderer, cx - dx, cy + dy_f, cx + dx, cy + dy_f);
}
}
}

pub fn renderBezierArrow(
Comment thread
forketyfork marked this conversation as resolved.
renderer: *c.SDL_Renderer,
x1: f32,
Expand Down
45 changes: 0 additions & 45 deletions src/input/mapper.zig
Original file line number Diff line number Diff line change
Expand Up @@ -79,51 +79,6 @@ fn computeCsiModifier(mod: c.SDL_Keymod) u8 {
return result;
}

pub fn keyToChar(key: c.SDL_Keycode, mod: c.SDL_Keymod) ?u8 {
const shift = (mod & c.SDL_KMOD_SHIFT) != 0;

if (key >= c.SDLK_A and key <= c.SDLK_Z) {
const base: u8 = @intCast(key - c.SDLK_A);
return if (shift) 'A' + base else 'a' + base;
}

if (key >= c.SDLK_0 and key <= c.SDLK_9) {
if (shift) {
return switch (key) {
c.SDLK_0 => ')',
c.SDLK_1 => '!',
c.SDLK_2 => '@',
c.SDLK_3 => '#',
c.SDLK_4 => '$',
c.SDLK_5 => '%',
c.SDLK_6 => '^',
c.SDLK_7 => '&',
c.SDLK_8 => '*',
c.SDLK_9 => '(',
else => null,
};
}
const base: u8 = @intCast(key - c.SDLK_0);
return '0' + base;
}

return switch (key) {
c.SDLK_SPACE => ' ',
c.SDLK_MINUS => if (shift) '_' else '-',
c.SDLK_EQUALS => if (shift) '+' else '=',
c.SDLK_LEFTBRACKET => if (shift) '{' else '[',
c.SDLK_RIGHTBRACKET => if (shift) '}' else ']',
c.SDLK_BACKSLASH => if (shift) '|' else '\\',
c.SDLK_SEMICOLON => if (shift) ':' else ';',
c.SDLK_APOSTROPHE => if (shift) '"' else '\'',
c.SDLK_GRAVE => if (shift) '~' else '`',
c.SDLK_COMMA => if (shift) '<' else ',',
c.SDLK_PERIOD => if (shift) '>' else '.',
c.SDLK_SLASH => if (shift) '?' else '/',
else => null,
};
}

/// Encodes an SDL key with modifiers into a terminal escape sequence.
/// cursor_keys: when true (DECCKM mode set), arrow keys use SS3 sequences (\x1bO...)
/// kitty_enabled: when true, use Kitty keyboard protocol for modified special keys
Expand Down