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>
Pane-Oriented Text Editor
Need to come up with a better name.
Text editor for pane-oriented editing.
Notes
-
consider vizia, freya as potential GUI frameworks
-
text buffer data structure concerns: https://coredumped.dev/2023/08/09/text-showdown-gap-buffers-vs-ropes/
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
- Lapcse-inspired code lens: https://docs.lapce.dev/features/code-lens