Files
RedBear-OS/local
vasilito 28906f16cf tlc: phase 24 — editor word sort (Alt-F8)
Mirrors MC's edit_sort_cmd flow (CK_Sort / M-F8 →
src/editor/editcmd.c::edit_sort_cmd):

  1. Require a marked block; surface error message if no
     selection is active.
  2. Stash the active selection to a unique temp file under
     /tlc-sort-<nanos>/in.txt (per-call unique dir to
     avoid races between concurrent sort runs).
  3. Run via 'sh -c sort <opts> <in> > <out>' so user-supplied
     options pass through verbatim (matches MC g_strconcat).
     Empty options means default lexical sort.
  4. On non-zero exit: surface exit code + first stderr line.
  5. On success: delete the original selection, insert the
     sorted output at the cursor, mark buffer modified, and
     surface a status line ('Sort: ok (N bytes, M lines)').

Components:
  src/editor/mode.rs — new PromptKind::Sort variant.
  src/editor/handlers.rs — Alt-F8 keybind (errors if no
    selection, otherwise opens the sort prompt); commit_prompt
    routes PromptKind::Sort to Editor::sort_block(options).
  src/editor/render.rs — title ('Run sort') + label ('sort
    options (empty for default)') + mode tag (' [Sort]') for
    the prompt.
  src/editor/mod.rs — Editor::sort_block(options).

Tests: 1153 passed (was 1150, +3):
  - sort_block_sorts_active_selection (apple/banana/cherry)
  - sort_block_with_no_selection_reports_error
  - sort_block_with_reverse_flag (-r → c/b/a)
Release binaries build clean.

PLAN.md §15d row 32a marked Done.
2026-06-20 22:09:49 +03:00
..