updating readme and roadmap

This commit is contained in:
2025-11-30 18:54:24 -08:00
parent 1a37a92534
commit 6498213378
4 changed files with 25 additions and 238 deletions

5
.idea/workspace.xml generated
View File

@@ -34,9 +34,10 @@
</component>
<component name="ChangeListManager">
<list default="true" id="e1fe3ab0-3650-4fca-8664-a247d5dfa457" name="Changes" comment="Add buffer position display and documentation improvements.&#10;&#10;- Display buffer position prefix &quot;[x/N]&quot; in GUI and terminal renderers.&#10;- Improve `kte` and `kge` man pages with frontend usage details and project homepage.&#10;- Update README with GUI invocation instructions.&#10;- Bump version to 1.0.0.">
<change afterPath="$PROJECT_DIR$/docs/screenshot.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/CMakeLists.txt" beforeDir="false" afterPath="$PROJECT_DIR$/CMakeLists.txt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ROADMAP.md" beforeDir="false" afterPath="$PROJECT_DIR$/ROADMAP.md" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -170,7 +171,7 @@
<workItem from="1764539556448" duration="156000" />
<workItem from="1764539725338" duration="1075000" />
<workItem from="1764542392763" duration="3512000" />
<workItem from="1764548345516" duration="8695000" />
<workItem from="1764548345516" duration="9275000" />
</task>
<task id="LOCAL-00001" summary="Add undo/redo infrastructure and buffer management additions.">
<option name="closed" value="true" />

View File

@@ -180,9 +180,20 @@ if (${BUILD_GUI})
MACOSX_BUNDLE_ICON_FILE ${MACOSX_BUNDLE_ICON_FILE}
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_BINARY_DIR}/kge-Info.plist")
add_dependencies(kge kte)
add_custom_command(TARGET kge POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
$<TARGET_FILE:kte>
$<TARGET_FILE_DIR:kge>/kte
COMMENT "Copying kte binary into kge.app bundle")
install(TARGETS kge
BUNDLE DESTINATION .
)
install(TARGETS kte
RUNTIME DESTINATION kge.app/Contents/MacOS
)
else ()
install(TARGETS kge
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}

126
README.md
View File

@@ -11,7 +11,9 @@ can learn and keep in your head.
I am experimenting with using Jetbrains Junie to assist in
development, largely as a way to learn the effective use of agentic
coding.
coding. I worked with the agent by feeding it notes that I've been
taking about text editors for the last few years, as well as the
sources from the original ke editor that is all handwritten C.
Project Goals
-------------
@@ -26,98 +28,6 @@ Project Goals
so a GUI can grow independently of the TUI.
- Minimize dependencies; the GUI layer remains optional and isolated.
User Experience (intended)
--------------------------
- Terminal first: instant startup, responsive editing, no surprises
over SSH.
- Optional GUI: an ImGuibased window with tabs, menus, and
palette-sharing the same editor core and command model.
- Discoverable command model: WordStar/VDE style with a `C-k` prefix,
Emacslike incremental search, and context help.
- Sensible defaults with a simple config file for remaps and theme
selection.
- Respect the file system: no magic project files; autosave and
crashrecovery journals are optin and visible.
Core Features (roadmapped)
--------------------------
- Buffers and windows
- Multiple file buffers; fast switching, closing, and reopening.
- Split views (horizontal/vertical) in TUI and tiled panels in
GUI.
- Editing primitives
- Gap buffer (primary) with an alternative piece table for
largeedit scenarios.
- Kill/yank ring, word/sentence/paragraph motions, and rectangle
ops.
- Undo/redo with grouped edits and timetravel scrubbing.
- Search and replace
- Incremental search (C-s) and regex search (C-r) with live
highlighting.
- Multifile grep with a quickfix list; replace with confirm.
- Files and projects
- Robust encoding/lineending detection; safe writes (atomic where
possible).
- File tree sidebar (GUI) and quickopen palette.
- Lightweight session restore.
- Language niceties (optin, no runtime servers required)
- Syntax highlighting via fast, tabledriven lexers.
- Basic indentation rules per language; trailing whitespace/EOF
newline helpers.
- Extensibility (later)
- Command palette actions backed by the core command model.
- Small C++ plugin ABI and a scripting shim for configtime
customization.
Interfaces
----------
- CLI: the primary interface. `kte [files]` starts in the terminal,
adopting your `$TERM` capabilities. Terminal mode is implemented
using ncurses.
- GUI: an optional ImGuibased frontend that embeds the same editor
core.
Man pages
---------
- Terminal editor: `docs/kte.1` (view locally with `man -l docs/kte.1`)
- GUI frontend: `docs/kge.1` (view locally with `man -l docs/kge.1`)
The `ke` keybinding reference remains the canonical source for
commands while kte evolves: see `docs/ke.md`.
Architecture (intended)
-----------------------
- Core model
- Buffer: file I/O, cursor/mark, viewport state, and edit
operations.
- GapBuffer: fast inmemory text structure for typical edits.
- PieceTable: alternative representation for heavy insert/delete
workflows.
- Controller layer
- InputHandler interface with `TerminalInputHandler` and
`GUIInputHandler` implementations.
- Command: normalized operations (save, kill, yank, move, search,
etc.).
- View layer
- Renderer interface with `TerminalRenderer` and `GUIRenderer`
implementations.
- Editor: toplevel state managing buffers, messaging, and global
flags.
Performance and Reliability Targets
-----------------------------------
- Submillisecond keystroke to screen update on typical files in TUI.
- Sustain fluid editing on multimegabyte files; graceful degradation
on very large files.
- Atomic/safe writes; autosave and crashrecovery journals are
explicit and transparent.
Keybindings
-----------
kte maintains kes command model while internals evolve. Highlights (subject to refinement):
@@ -212,31 +122,5 @@ cmake --build cmake-build-debug
Status
------
- The project is under active evolution toward the above architecture
and UX. The terminal interface now uses ncurses for input and
rendering. GUI work will follow as a thin, optional layer. ke
compatibility remains a primary constraint while internals modernize.
Roadmap (high level)
--------------------
1. Solidify core buffer model (gap buffer), file I/O, and
kecompatible commands.
2. Introduce structured undo/redo and search/replace with
highlighting.
3. Stabilize terminal renderer and input handling across common
terminals. (initial ncurses implementation landed)
4. Add piece table as an alternative backend with runtime selection
per buffer.
5. Optional GUI frontend using ImGui; shared command palette.
6. Language niceties (syntax highlighting, indentation rules) behind a
zerodeps, fast path.
7. Session restore, autosave/journaling, and safe write guarantees.
8. Extensibility hooks with a small, stable API.
References
----------
- [ke](https://git.wntrmute.dev/kyle/ke) manual and keybinding
reference: `ke.md`
- Inspirations: Antirez kilo, WordStar/VDE, Emacs, and `mg(1)`
- This project is a hobby text editor meant to be my personal editor. I
do not warrant its suitability for anyone else.

View File

@@ -1,116 +1,7 @@
kte ROADMAP — from skeleton to a working editor
ROADMAP / TODO:
Scope for “working editor” v0.1
- Runs in a terminal; opens files passed on the CLI or an empty buffer.
- Basic navigation, insert/delete, newline handling.
- Status line and message area; shows filename, dirty flag, cursor position.
- Save file(s) to disk safely; quit/confirm on dirty buffers.
- Core ke key chords: C-g (cancel), C-k s/x/q/C-q, C-l, basic arrows, Enter/Backspace, C-s (simple find).
Guiding principles
- Keep the core small and understandable; evolve incrementally.
- Separate model (Buffer/Editor), control (Input/Command), and view (Renderer).
- Favor terminal first; GUI hooks arrive later behind interfaces.
✓ Milestone 0 — Wire up a minimal app shell
1. main.cpp
- Replace demo printing with real startup using `Editor`.
- Parse CLI args; open each path into a buffer (create empty if none). ✓ when `kte file1 file2` loads buffers and
exits cleanly.
2. Editor integration
- Ensure `Editor` can open/switch/close buffers and hold status messages.
- Add a temporary “headless loop” to prove open/save calls work.
✓ Milestone 1 — Command model
1. Command vocabulary
- Flesh out `Command.h/.cpp`: enums/struct for operations and data (e.g., InsertChar, MoveCursor, Save, Quit,
FindNext, etc.).
- Provide a dispatcher entry point callable from the input layer to mutate `Editor`/`Buffer`.
- Definition of done: commands exist for minimal edit/navigation/save/quit; no rendering yet.
✓ Milestone 2 — Terminal input
1. Input interfaces
- Add `InputHandler.h` interface plus `TerminalInputHandler` implementation.
- Terminal input via ncurses (`getch`, `keypad`, nonblocking with `nodelay`), basic key decoding (arrows, Ctrl, ESC
sequences).
2. Keymap
- Map ke chords to `Command` (C-k prefix handling, C-g cancel, C-l refresh, C-k s/x/q/C-q, C-s find start, text
input → InsertChar).
3. Event loop
- Introduce the core loop in main: read key → translate to `Command` → dispatch → trigger render.
✓ Milestone 3 — Terminal renderer
1. View interfaces
- Add `Renderer.h` with `TerminalRenderer` implementation (ncursesbased).
2. Minimal draw
- Render viewport lines from current buffer; draw status bar (filename, dirty, row:col, message).
- Handle scrolling when cursor moves past edges; support window resize (SIGWINCH).
3. Cursor
- Place terminal cursor at logical buffer location (account for tabs later; start with plain text).
Milestone 4 — Buffer fundamentals to support editing
1. GapBuffer
- Ensure `GapBuffer` supports insert char, backspace, delete, newline, and efficient cursor moves.
2. Buffer API
- File I/O (open/save), dirty tracking, encoding/line ending kept simple (UTF8, LF) for v0.1.
- Cursor state, mark (optional later), and viewport bookkeeping.
3. Basic motions
- Left/Right/Up/Down, Home/End, PageUp/PageDown; word f/b (optional in v0.1).
Milestone 5 — Core editing loop complete
1. Tighten loop timing
- Ensure keystroke→update→render latency is reliably low; avoid unnecessary redraws.
2. Status/messages
- `Editor::SetStatus()` shows transient messages; C-l forces full refresh.
3. Prompts
- Minimal prompt line for saveas/confirm quit; blocking read in prompt mode is acceptable for v0.1.
Milestone 6 — Search (minimal)
1. Incremental search (C-s)
- Simple forward substring search with live highlight of current match; arrow keys navigate matches while in search
mode (kestyle quirk acceptable).
- ESC/C-g exits search; Enter confirms and leaves cursor on match.
Milestone 7 — Safety and polish for v0.1
1. Safe writes
- Write to temp file then rename; preserve permissions where possible.
2. Dirty/quit logic
- Confirm on quit when any buffer is dirty; `C-k C-q` bypasses confirmation.
3. Resize/terminal quirks
- Handle small terminals gracefully; no crashes on narrow widths.
4. Basic tests
- Unit tests for `GapBuffer`, Buffer open/save roundtrip, and command mapping.
Out of scope for v0.1 (tracked, not blocking)
- Undo/redo, regex search, kill ring, word motions, tabs/render width, syntax highlighting, piece table selection, GUI.
Implementation notes (files to add)
- Input: `InputHandler.h`, `TerminalInputHandler.cc/h` (ncurses).
- Rendering: `Renderer.h`, `TerminalRenderer.cc/h` (ncurses).
- Prompt helpers: minimal utility for line input in raw mode.
- Platform: small termios wrapper; SIGWINCH handler.
Acceptance checklist for v0.1
- Start: `./kte [files]` opens files or an empty buffer.
- Edit: insert text, backspace, newlines; move cursor; content scrolls.
- Save: `C-k s` writes file atomically; dirty flag clears; status shows bytes written.
- Quit: `C-k q` confirms if dirty; `C-k C-q` exits without confirm; `C-k x` save+exit.
- Refresh: `C-l` redraws.
- Search: `C-s` finds next while typing; ESC cancels.
Next concrete step
- Stabilize cursor placement and scrolling logic; add resize handling and begin minimal prompt for saveas.
- [ ] Search + Replace
- [ ] Regex search + replace
- [ ] The undo system should actually work
- [ ] Able to mark buffers as read-only
- [ ] Built-in help text