No description
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-10-04 00:02:29 +01:00
tools complete slopped up code editor 2026-10-04 00:02:29 +01:00
.gitignore complete slopped up code editor 2026-10-04 00:02:29 +01:00
editor_test.odin complete slopped up code editor 2026-10-04 00:02:29 +01:00
fonts.odin complete slopped up code editor 2026-10-04 00:02:29 +01:00
main.odin complete slopped up code editor 2026-10-04 00:02:29 +01:00
palette.odin complete slopped up code editor 2026-10-04 00:02:29 +01:00
persistence.odin complete slopped up code editor 2026-10-04 00:02:29 +01:00
plan.md complete slopped up code editor 2026-10-04 00:02:29 +01:00
README complete slopped up code editor 2026-10-04 00:02:29 +01:00
text.odin complete slopped up code editor 2026-10-04 00:02:29 +01:00

 __                                __ __ __                                       __          __                     
|  |--.-----.--.--.______.-----.--|  |__|  |_.-----.----.______.-----.----.-----.|  |_.-----.|  |_.--.--.-----.-----.
|  _  |  _  |_   _|______|  -__|  _  |  |   _|  _  |   _|______|  _  |   _|  _  ||   _|  _  ||   _|  |  |  _  |  -__|
|_____|_____|__.__|      |_____|_____|__|____|_____|__|        |   __|__| |_____||____|_____||____|___  |   __|_____|
                                                               |__|                               |_____|__|         

---



Build
-----

    odin build tools/build.odin -file -out:build
    ./build build
    ./build run

Other commands: `check`, `test`, `release`, `debug`, `install`, and `clean`.

The prototype opens with three sample panes. The default document is
`documents/scratch.odin`; closing the window saves it automatically. Reopening
restores the arrangement. `*` in the status bar marks unsaved changes.

Choose another document and optionally monospace and proportional UI TTF fonts:

    ./build run documents/demo.odin
    ./build run documents/demo.odin /path/to/font.ttf
    ./build run documents/demo.odin /path/to/code.ttf /path/to/ui.ttf

The parent directory must exist. Monaco (macOS), DejaVu Sans Mono (Linux), or
Consolas (Windows) is discovered automatically. Build/run support depends on
having Odin and its bundled raylib libraries installed for your platform.

High-DPI rendering is enabled. Font atlases use the display pixel density and
cover the maximum canvas zoom; they reload when the window moves to a display
with a different DPI. Code stays monospace. Pane labels, toolbar, and status
bar use Arial (macOS), DejaVu Sans (Linux), or Segoe UI (Windows), with raylib's
built-in font as a fallback if no UI font is available.

The default light scheme uses warm paper, dark code text, and fine pane
boundaries. A short mark beside the pane label indicates focus. Panes fit
their longest line and total line count, growing and shrinking as you edit.
A little padding and room for the caret remain; the top-left position stays
fixed. Existing documents are fitted on reopen.

Controls
--------

- Cmd/Ctrl+N creates a focused pane at the pointer, including on empty canvas.
  Insert also creates one in empty space.
- Click text to focus/place the cursor. Drag text or hold Shift to select.
- Drag the header to move a pane. Pane size follows its content automatically.
- Right or middle mouse drag pans. Space+left drag pans when no pane is focused.
- Wheel anywhere on the canvas zooms around the pointer. Cmd/Ctrl+0 resets
  to 100%, keeping the centre of the window fixed.
- Arrows, Home/End, Shift selection, Backspace/Delete, Enter, and Tab edit text.
  On macOS, Cmd+Left/Right moves to line start/end; adding Shift selects to
  that boundary. Option+Left/Right moves by word; Option+Shift+Left/Right
  selects by word. Identifiers (including underscores) count as words.
- Enter carries the current line's leading tabs/spaces onto the new line.
  After an opening `{`, it adds one indentation level (a tab, or four spaces
  when the current indentation uses spaces).
- Cmd/Ctrl+A/C/X/V selects all, copies, cuts, and pastes. Tab uses four-column stops.
- Cmd/Ctrl+Shift+Backspace deletes the focused pane and its text. Click a pane
  first; focus clears after deletion. Ordinary Backspace/Delete still edit text.
- Cmd/Ctrl+S saves. Escape clears focus. Close the window to exit and save.

Persistence
-----------

`demo.odin.layout` is the authoritative, versioned spatial document: node IDs,
rectangles, UTF-8 text, and camera position/zoom. `demo.odin` is ordinary source,
regenerated by concatenating panes in creation order with two newlines between
panes. Keep the pair together. Package/import declarations can live in their
own pane; spatial position does not affect serialization.

Save stages both files before replacement. Replacing the pair is not a single
filesystem transaction; after an interrupted save, reopen the layout and save
again to regenerate the source. Invalid layouts are rejected without changing
the document. Existing source without a layout is refused to avoid overwriting
it. Importing arbitrary Odin files and merging external source edits are not
supported. Keep editor documents in a subdirectory so their `.odin` files are
not included when compiling this editor.

Scope
-----

This is the first interaction milestone: up to 1024 panes, 64 KiB per pane,
UTF-8 cursor movement, rectangular clipping, selection, clipboard, and spatial
save/load. Text is unwrapped; panes expand to fit it in both dimensions. The
font atlas contains ASCII; other characters are preserved but may render as
fallback glyphs. No undo/redo (including pane deletion), syntax highlighting,
LSP, or external-source parsing yet.

Run `./build test` (or `odin test .`) for text editing, capacity, malformed
layout, serialization ordering, and save/reopen tests.