Pad/internal/editor
Greg Pomerantz 9b782190fa editor: honor key.EditEvent.Range in HandleReplaceRange (IME swipe/autocorrect)
The IME commit path (swipe-to-type, autocorrect replacement) sends a
key.EditEvent with a Range that the editor ignored, causing the replaced
region to be duplicated. Add Logic.HandleReplaceRange which deletes the
rune range [start,end) and inserts text, converting rune indices to byte
offsets (string path: utf8.DecodeRuneInString; chunked path: leading-byte
scan). HandleKeyDown now routes key.EditEvent through it.

Also fixes two pre-existing ChunkedBuffer correctness bugs the tests
exposed:
- Delete mis-computed the per-chunk end using a shrinking 'remaining'
  instead of the absolute end, corrupting multi-chunk deletes.
- FullContent derived its chunk bound solely from fileLen, truncating
  in-memory chunks grown past the old bound by an insert.

Adds ime_range_test.go covering insert/replace/delete, unicode, chunked,
and swapped bounds. go test -race ./... green.
2026-08-16 02:18:44 -04:00
..
auto_save_test.go Fix test build after NewLogic signature change; add development plan draft 2026-08-15 22:18:04 -04:00
buffer_test.go fix(editor): wire key events to cursor movement 2026-06-03 07:41:18 -04:00
chunked_buffer_test.go feat: virtual scrolling with chunked buffer for large files 2026-06-05 09:11:32 -04:00
chunked_buffer.go editor: honor key.EditEvent.Range in HandleReplaceRange (IME swipe/autocorrect) 2026-08-16 02:18:44 -04:00
cursor_test.go fix: update tests and fix SetCursorFromPoint panic 2026-06-04 07:24:44 -04:00
deterministic_file.go feat: virtual scrolling with chunked buffer for large files 2026-06-05 09:11:32 -04:00
e2e_test.go Make state single-owner and stabilize race detector 2026-08-16 01:32:27 -04:00
filename_test.go feat: implement atomic writes for filesystem backend 2026-06-04 18:01:51 -04:00
frame.go Make state single-owner and stabilize race detector 2026-08-16 01:32:27 -04:00
ime_range_test.go editor: honor key.EditEvent.Range in HandleReplaceRange (IME swipe/autocorrect) 2026-08-16 02:18:44 -04:00
integration_test.go Make state single-owner and stabilize race detector 2026-08-16 01:32:27 -04:00
logic.go Make state single-owner and stabilize race detector 2026-08-16 01:32:27 -04:00
mock_setup.go Integrate real filesystem with interface abstraction 2026-06-04 16:19:38 -04:00
scroll_fix_test.go WIP baseline: Termux open-file bridge + word-wrap-aware viewport/scroll 2026-08-16 00:31:26 -04:00
state.go editor: honor key.EditEvent.Range in HandleReplaceRange (IME swipe/autocorrect) 2026-08-16 02:18:44 -04:00