···5858 - FFT: 2k R2C (`realfft`) on tick thread; maintains raw/smoothed/normalized buffers with peak tracking; `--debug-fft` throttled print; Lua `fft/ffts/fftr/fftrs` wired with C-identical clamping/sum semantics; headless tests added; simple cart at `assets/fft_test.lua`.
5959- Screenshots: CLI supports `--screenshot <path> [--screenshot-scale N] [--screenshot-frame N]` and `--headless` offscreen capture. In windowed mode, F12 saves to `./screenshots/scr-YYYYmmdd-HHMMSS.png` without exiting.
6060- Editor: CODE view supports basic editing (insert chars/newline/tab, backspace/delete, Home/End), selection (Shift+arrows), clipboard (Ctrl/Cmd+C/V/X), undo/redo (Ctrl/Cmd+Z / Shift+Z or Y). Caret + auto-scroll; gutter and rendering intact; tests added.
6161+6262+ - Editor visuals parity:
6363+ - Palette switched to Sweetie16 (source-accurate); white is idx=12; greys 13/14/15.
6464+ - Selection shadows fixed: per-cell 7×7 shadow+fill with outer-perimeter edges; no interior seams; right-edge shadow 7 px tall.
6565+ - Toolbar top bar matches TIC-80: 7 px white bar; left “CODE” label in grey (14); RUN/STOP/RESET labels in grey; no left underline.
6666+ - Code grid: small font (6 px) on 7 px pitch; first row starts immediately under the bar; gutter is 18 px (3 digits) plus a 1 px gap before code.
6767+ - Caret uses cursor color idx 2 with 1 px drop shadow; glyph under caret redrawn in background color.
6868+ - Fixed text insertion baseline (no 1 px vertical drift); selection and caret aligned to same baseline.
6169 - Editor selection shadows: multi-line selection now renders without interior seams; bottom shadow is only drawn on outer perimeter segments. Headless diagnostic flag added to aid screenshots.
62706371**Near-Term Backlog**
···142150 - Ran `cargo fmt`, `cargo clippy --all-targets --all-features -D warnings`, and `cargo test`: all green.
143151 - Conducted a full code review of the `tic80_rust` crate. Findings are positive; suggestions for minor refactorings have been logged in `docs/roadmap/todos_code_review.md` and a summary added to `docs/adr/codereviews/001.md`.
144152 - Performed a second code review. The summary is located at `docs/adr/codereviews/002_ai_review.md` and actionable suggestions are in `docs/roadmap/todos_from_ai_review.md`.
145145-- 2025-08-27 (cont.):
153153+ - 2025-08-27 (cont.):
146154 - Editor basic editing implemented and tested:
147155 - Text input (ReceivedCharacter), Enter newline, Tab → one space; Backspace/Delete; Home/End.
148156 - Selection with Shift+arrows; clipboard shortcuts (copy/cut/paste) using OS clipboard; select-all.
···153161 - Editor polish and bugfixes:
154162 - macOS Cmd shortcuts fixed by using per-event modifiers (`KeyboardInput.modifiers`) for Cmd/Ctrl detection.
155163 - Selection highlight aligned with caret box (vertical off-by-one vs clip corrected); added unit test for alignment.
164164+ - 2025-09-01:
165165+ - Switched framebuffer palette to Sweetie16 (exact TIC-80 ordering); updated palette mapping tests.
166166+ - Implemented selection per-cell shadowing; removed interior seams; added tests for no-seam and 7 px right-edge shadow.
167167+ - Top bar parity: 7 px white toolbar; “CODE” grey label; removed shadow for title; removed CONSOLE tab visuals.
168168+ - Editor layout tightened: small-font baseline, 7 px line pitch, gutter=18 px with 1 px gap; first row starts immediately below the bar; removed extra paddings.
169169+ - Fixed new-text baseline misalignment (was rendered 1 px too low); unified small-font rendering across normal/selected/caret glyphs.
170170+ - Tests and docs updated; clippy/tests green.
156171 - 2025-09-01:
157172 - Fixed editor selection drop shadow to avoid interior horizontal seams for multi-line selections.
158173 - Implemented per-row bottom shadow segmentation by subtracting next-row overlap; right-edge rule preserved.
+1-1
docs/README.md
···1414- `docs/specs/lua_api_parity.md`: API parity checklist for Lua (name, signature, side effects).
1515- `docs/specs/graphics.md`: Framebuffer, palette mapping, text/print semantics (stub to be expanded).
1616- `docs/specs/audio_fft_vqt.md`: FFT/VQT behavior and Rust implementation plan (cpal + realfft), with links to `CLAUDE.md`.
1717-- `docs/specs/implementation_status.md`: What’s implemented vs pending, with notes on behavior.
1717+- `docs/specs/implementation_status.md`: What’s implemented vs pending, with notes on behavior. Palette is Sweetie16 (white=12; greys 13/14/15).
18181919## Architecture
2020- `docs/architecture/workspace.md`: Crate layout and module boundaries.
+8-1
docs/architecture/editor.md
···2020- Position stays aligned to the 6×8 grid; auto-scrolling keeps caret visible.
21212222## Selection & Shadows
2323-- Selection fill uses palette 14 (pink) and respects the 6×8 cell grid.
2323+- Selection fill uses palette index 14 (grey, Sweetie16) and respects the 6×8 cell grid.
2424- Drop shadow (palette 0) is rendered only on the outer perimeter:
2525 - Right edge: draw a 1px vertical line unless the next row’s selection extends strictly further right (to keep the outer edge clean).
2626 - Bottom edge: drawn per-segment by subtracting the next row’s covered columns. If the next row overlaps, no interior horizontal seam is drawn; only left/right overhangs render a bottom shadow.
2727 - This matches TIC‑80’s visual continuity for multi-line selections (no interior seams).
2828+2929+## Top Bar & Layout
3030+- Toolbar height: 7 px (1 px margins around 6 px small font).
3131+- Title: left‑aligned “CODE” in grey (palette 14); no shadow in the current build (can be re‑enabled later).
3232+- Background: white (palette 12).
3333+- Gutter: 3 digits (18 px) width; a 1 px gap separates gutter and code.
3434+- Text grid: 6 px small font on a 7 px line pitch; first code row starts immediately under the toolbar (no extra padding).
28352936## Input
3037- Tabs and buttons: rectangle hit testing in framebuffer space.
+2-2
docs/architecture/workspace.md
···2233Crates (target layout)
44- `tic-core`: VM state, memory map, cart model, fixed-step ticker.
55-- `tic-gfx`: CPU rasterizer (`pix/line/rect/...`), VRAM/VRAM banks, palette ops.
55+ - `tic-gfx`: CPU rasterizer (`pix/line/rect/...`), VRAM/VRAM banks, palette ops (Sweetie16 palette ordering).
66- `tic-audio`: PSG synth + mixer; later capture buffer for FX.
77- `tic-io`: Input abstraction (kbd/mouse/gamepad), FS/cart IO, time.
88- `tic-api`: Language-agnostic API facade matching TIC-80 surface.
···13131414Data Flow
1515- Lua (`tic-lua`) calls into `tic-api` → forwards to `tic-core/gfx/audio/io`.
1616-- `tic-gfx` writes to VRAM page(s); presenter converts palette indices to RGBA for display.
1616+ - `tic-gfx` writes to VRAM page(s); presenter converts palette indices to RGBA for display using Sweetie16 (white=12; greys 13/14/15).
1717- `tic-audio` produces sample blocks; optional capture ring shared with `tic-fx`.
1818- `tic-studio` (planned): A framebuffer‑rendered TIC‑80‑style UI. We will deliver CODE first, then CONSOLE (console scope may be reduced). Integrates with `tic-runner`/`tic-core` for hot reload and .tic code‑only round‑trip. See `docs/roadmap/editor_livecoding.md`.
+6-2
docs/specs/implementation_status.md
···7777 - `fget`, `fset`.
78787979Implemented (Editor)
8080-- UI shell: top bar (tabs + buttons) rendered in framebuffer; integer-scaling window.
8181-- CODE view: rope‑backed buffer; editable; gutter; selection highlight; TIC‑style caret (red box + shadow with inverted glyph); 6×8 cell grid.
8080+- UI shell: top bar rendered in framebuffer; integer-scaling window.
8181+- Toolbar: 7 px tall; background white (index 12); left title “CODE” in grey (14); RUN/STOP/RESET labels in grey.
8282+- CODE view: rope‑backed buffer; editable; gutter; selection highlight; TIC‑style caret (cursor color index 2 + shadow); 6 px small font on a 7 px pitch.
8383+- Layout: gutter 18 px wide (3 digits), 1 px gap before code; first row starts directly under the toolbar; no extra top/bottom padding.
8484+- Selection: per‑cell 7×7 shadow+fill; outer-perimeter shadow only; no inter‑line seams.
8285- Navigation: arrows, Home/End; auto‑scroll keeps caret visible.
8386- Editing: insert chars/newline/tab (1 space), backspace/delete with line joins at SOL/EOL.
8487- Selection/Clipboard: Shift+arrows; Select All (Cmd/Ctrl+A); copy/cut/paste via OS clipboard (Cmd/Ctrl+C/V/X).
···9598- API parity checklist: `docs/specs/lua_api_parity.md`.
9699- Testing strategy and catalog: `docs/testing/strategy.md`, `docs/testing/test_catalog.md`.
97100 - Hygiene: clippy pedantic baseline enforced with curated allows for DSP and TIC-style APIs; see `AGENTS.md` for current lint policy and status.
101101+ - Palette: uses Sweetie16 (TIC‑80 default) with white at index 12 and greys at 13/14/15.
+3-2
docs/testing/test_catalog.md
···88 - `pix_read_write_and_bounds`: `pix` read/write semantics; OOB reads return `None` and writes are ignored.
99 - `rect_fill_and_clipping`: `rect` fills and clips to viewport; fully OOB rects are no‑ops.
1010 - `line_basic_counts_and_endpoints`: Line endpoints colored; counts match `max(dx,dy)+1` both directions.
1111- - `blit_to_rgba_maps_palette`: Palette index→RGBA mapping matches expected sRGB bytes.
1111+ - `blit_to_rgba_maps_palette`: Palette index→RGBA mapping matches Sweetie16 sRGB bytes (white=idx12, greys idx13/14/15).
1212 - `rectb_draws_border`: `rectb` draws a 1‑px border; interior remains unchanged.
1313 - `clip_limits_drawing_and_reset`: Clip restricts drawing; reset restores full viewport.
1414 - `print_width_fixed_vs_variable_and_newline`: `print_text` width (fixed vs variable), newline row advance, and scale behavior.
···7575- `tic80_rust/tests/editor_code_view_tests.rs`: CODE viewport renders gutter digits and text cells.
7676- `tic80_rust/tests/editor_editing_tests.rs`: basic editing behavior for insert/newline, backspace (join-prev), delete (join-next), Home/End, and Tab-as-spaces.
7777- `tic80_rust/tests/editor_selection_undo_tests.rs`: selection replace/cut/paste and undo/redo cycles; select-all.
7878- - Planned: `editor_selection_shadow_tests.rs`: verify multi-line selection renders without interior bottom seams and only draws right-edge shadow on the outer perimeter (uses deterministic framebuffer pixels).
7878+- `tic80_rust/tests/editor_selection_shadow_tests.rs`: multi-line selection renders without interior bottom seams; right-edge shadow is exactly 7 px tall.
7979+- `tic80_rust/tests/editor_selection_align_tests.rs`: selection top aligns with caret box (small font baseline at 6 px, pitch 7 px).
79808081## Screenshot Tests
8182- `tic80_rust/tests/screenshot_smoke.rs`