Greg ShuflinandClaude Opus 4.6 f80cc2da0d Refactor event loop from timer-driven to render-after-input
Replace the dual-rate timer rendering architecture with a direct
render-after-input loop. The old design used a background tokio task
(EventHandler) that ran two interval timers — 30 FPS while "active"
and 2 FPS when idle — forwarding events through an mpsc channel. This
introduced up to ~33ms of latency between a keypress and its screen
update, and added unnecessary complexity (background task, channel,
activity threshold heuristic).

The new design uses a single tokio::select! loop with three arms:
  1. Keyboard input: renders immediately after processing, then drains
     any additional buffered input via non-blocking poll before drawing
  2. Async command results: handles actions from the command channel
     (file I/O completion, etc.) and renders
  3. Idle timeout (500ms): renders for background updates like cursor
     blink

Structural changes:
- Remove Event enum, EventHandler struct, and its background task
- TerminalUI now owns crossterm::event::EventStream and the command
  output UnboundedReceiver directly
- EditorCore::new() returns (Self, UnboundedReceiver<EditorAction>)
  instead of storing the receiver internally
- Remove EditorCore::process_commands() — its logic moves into the
  main loop's select arm for command output
- Make EditorCore::handle_action() pub(crate) so the main loop can
  call it directly for command results
- Extract process_key() helper for KeyCode-to-Input mapping
- Add try_poll_crossterm() for non-blocking input draining

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 11:05:00 -08:00
2024-01-07 19:03:31 -08:00
2026-01-08 01:53:49 -08:00
2026-01-08 01:53:49 -08:00
2026-02-09 02:42:31 -08:00
2024-03-01 09:56:21 -08:00

Pane-Oriented Text Editor

Need to come up with a better name.

Text editor for pane-oriented editing.

Notes

Design Notes

The editor core is conceptually-separate from all frontends. It is responsible for managing the state and screen layout of any number of Buffers, all of which have a unique id. A Buffer may be visible or invisible, may be read-only or read-write, may be primarily for editing text or displaying information (including non-textual information) or accepting commands.

The editor core accepts a constant stream of EditorActions, which represent any action that affects the editor core state from any source - keyboard input, network input, file system changes, internal command evaluation, etc.

The main loop of the editor is running handle_action in a tight (parallelized) loop and repeatedly changing state based on the result.

There needs to be an AugmentedCore that has a conceptually-separate Core and Executor

UI NOtes

S
Description
Pane-based text buffer editor
Readme
354 KiB
0 Stars 1 Watchers 0 Forks
Languages
Rust 100%