Skip to content

Windows: selecting error text says copied but clipboard is empty; Ctrl+C to copy kills jcode #497

Closed

Description

@1jehuang

Reported by tawa.kul in Discord #general (2026-07-16), Windows terminal.

Two related copy-UX bugs when trying to copy an error message:

  1. Selecting the error text with the mouse shows a "copied" confirmation, but the clipboard is actually empty.
  2. Pressing Ctrl+C to copy the selection is interpreted as interrupt and closes jcode entirely, losing the error.

Net effect: there is no way to copy an error message out of jcode on Windows. Users need error text to file bug reports, so this compounds every other bug.

Note: #487 (merged) touched Windows terminal mouse handling and added a scroll_copy test, but the false "copied" toast and Ctrl+C-during-selection behavior are not specifically addressed.

Source: Discord report, https://discord.com/channels/1508955567048364062/1508955567048364065

Activity

  1. added
    bug
    on Jul 17, 2026
  2. 1jehuang commented on Jul 17, 2026

    @1jehuang
    OwnerAuthor

    Both halves addressed in 13babd5 (pending Windows verification):

    1. Ctrl+C killing jcode while copying: Ctrl+C with an active copy-mode selection now copies the selection (universal muscle memory) instead of falling through to the interrupt/quit handler. With no selection, Ctrl+C keeps its interrupt/quit behavior. Covered by 2 new regression tests.

    2. False 'copied' with empty clipboard: on Windows the clipboard order was OSC 52 -> arboard, and OSC 52 'succeeds' by writing to stdout even when the console silently drops the sequence (conhost, older Windows Terminal), so we reported Copied without touching the clipboard. Windows now uses the Win32 clipboard (arboard) first, with OSC 52 only as a remote-session fallback. Unix order is unchanged so SSH/tmux copy keeps working.

    Leaving open until verified on a real Windows machine (Azure Students sub has zero compute quota in every region, so this needs either the GitHub Actions windows runner or a physical box).

  3. 1jehuang commented on Jul 17, 2026

    @1jehuang
    OwnerAuthor

    Windows CI verification: the windows-latest job on master (run 29620004948+) passed with the new regression tests in the targeted list, including test_ctrl_c_with_active_copy_selection_copies_instead_of_quitting and test_ctrl_c_in_copy_mode_without_selection_still_falls_through running natively on Windows. The clipboard-order fix (Win32 API before OSC 52) compiles and links on the msvc target via CI as well.

    Closing. If anyone still sees a false 'copied' after the next release, please reopen with the terminal used (conhost vs Windows Terminal).

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions