Skip to content

[Bug]: Desktop composer is not a text editor — ↑ on the first line replaces a multi-line draft with a history prompt; no Home/End, no line delete, no spellcheck, no history picker #189

Todo

Description

@magicprinc

GUI version

0.1.63

Operating system

Windows

Reproduction steps

A. ↑ destroys a multi-line draft instead of moving the caret

  1. Type a prompt that spans several lines (or one long paragraph that soft-wraps).
  2. Put the caret on the first line — or anywhere in a long wrapped paragraph, see "Root cause" below.
  3. Press ↑.
  4. The whole draft is replaced by an older prompt from history and the caret jumps to the end of it.

B. Recovering the draft is a manual dance

  1. After ↑, press ↓ a few times to walk the history back.
  2. The draft only comes back if the navigation session is still alive; any reset clears the stash, and you are left retyping or hunting the text character by character.
  3. If you actually wanted the line above, you now have to find your place again — with the mouse or with single-character moves.

C. No line-editing keys

  1. Ctrl+Y does nothing (no line delete; nothing is bound to it at all).
  2. No way to delete the current line quickly, no Home/End behaviour beyond the browser default, no spellcheck underlines.

Expected behavior

The composer should behave like a normal text editor:

  • ↑/↓ move the caret through the text (including soft-wrapped visual rows). History recall must not fight that: it should require an explicit modifier (Ctrl+↑ / Ctrl+↓, or Alt+↑/↓) or an explicit picker, and it must never replace a non-empty draft silently.
  • Home / End = start / end of the current visual line; Ctrl+Home / Ctrl+End = start / end of the whole input.
  • Ctrl+Y deletes the current line (Ctrl+K is the more common binding and does not collide with the Windows "redo" convention — either is fine, ideally configurable).
  • Spellcheck works in the composer for the languages the user actually types, with suggestions on right-click.
  • Prompt history gets its own picker, like the Windows clipboard history: a button opens a dialog showing every saved prompt with its full timestamp (YYYY-MM-DD HH:MM:SS) and text, newest first, filterable, click to insert at the caret, plus per-entry delete and clear-all.

Actual behavior

  • ↑ on the first logical line calls history recall, discards the draft from view and moves the caret to the end. Because the "first line" test is done on \n positions, a single long wrapped paragraph counts as "first line" everywhere, so ↑ recalls history from any visual row of it.
  • ↓ on the last logical line does the reverse. The draft is stashed only inside the current navigation session (Map keyed by history index, cleared on resetNavigation()), so it is easy to lose.
  • Ctrl+Y is unbound; the composer does not intercept Home/End/line-editing keys at all.
  • No word is ever underlined and the "Add to dictionary" context-menu branch never appears, so spellcheck is effectively inert.

Screenshots, recordings, or sanitized logs

No recording needed — this is static, reproducible by key presses only.

Root cause read from the shipped bundle (symbol names are the minified ones from resources/app/out/renderer/assets/workspace-screen-*.js, so they can be grepped directly):

  1. The composer keydown handler (Oo) has exactly one arrow branch:

    if ((B.key==="ArrowUp"||B.key==="ArrowDown") && !er && !En && !metaKey && !ctrlKey && !altKey && !shiftKey) {
      const xe = nn.current;                                  // textarea
      if (xe && xe.selectionStart === xe.selectionEnd) {      // no selection
        const _e = xe.selectionStart, We = xe.value;
        if (B.key==="ArrowUp") {
          if (We.lastIndexOf("\n", _e-1) === -1) { B.preventDefault(); $(1); return; }   // recall older
        } else if (We.indexOf("\n", _e) === -1) { B.preventDefault(); $(-1); return; }   // recall newer
      }
    }

    Two problems in that test: (a) it fires on the first logical line, so wrapped text is misjudged; (b) when it fires it replaces the entire value, with no regard for existing content.

  2. $ is recallHistory from the N9 hook (BY wrapper around electronAPI.promptHistoryList/Add). It sets the whole input and then calls focusAtEnd(). The draft is saved in a local Map (l.current.set(p, e)) indexed by history position; resetNavigation() (c()) clears the map and resets the index to -1.

  3. There is no handler for Home, End, Ctrl+Y, Ctrl+K or line kill anywhere in the composer path — those keys fall through to the native <textarea> (rendered through the shared U_ component), and no application menu item binds Ctrl+Y either.

  4. Spellcheck: the composer <textarea> sets no spellCheck attribute, out/main/index.js never calls setSpellCheckerEnabled / setSpellCheckerLanguages, and the installed app ships no dictionaries/ directory. The context-menu handler does handle misspelledWord and dictionarySuggestions, but with no dictionary loaded that branch can never fire — hence no underlines and no suggestions.

  5. For the picker: the on-disk prompt history already stores exactly what the clipboard-style dialog needs. In @commandcode/harness (src/session/prompt-history.ts) entries are JSONL records { "p": <text>, "t": Date.now() }, capped at MAX_ENTRIES = 1000. But getAll() returns plain strings, the IPC handler forwards history: string[], and parseHistoryLine() tolerates both {p} and {text} — so timestamps exist on disk and are simply dropped before the renderer sees them. Exposing {p, t}[] would be backwards compatible.

Proposed requests

Part 1 — make the composer a real text editor: move history recall off bare ↑/↓ (modifier or picker only), never overwrite a non-empty draft without confirmation, add Home/End (and Ctrl+Home/End) semantics, line delete (Ctrl+Y as asked, or Ctrl+K), and working spellcheck with the user's languages.

Part 2 — history picker: a clock/history button in the composer toolbar that opens a dialog like the Windows clipboard history — list of saved prompts with YYYY-MM-DD HH:MM:SS and the full text, newest first, filter box, click to insert at the caret, per-entry delete, clear all. The timestamps are already persisted; only the transport and the UI are missing.

Safety check

  • I removed credentials and private project information from this report.

@aliarain @ahmadawais

Activity

  1. self-assigned this
    on Nov 25, 2026
  2. aliarain commented on Nov 25, 2026

    @aliarain
    Collaborator

    thanks, there are several requests in here. i'll check the up-arrow on a wrapped draft first, since losing your text is the worst part. no date for the rest yet but will get this shipped soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions