Skip to content

Releases: Ch1nYu/PasteFix

Pastefix v1.2.0

Choose a tag to compare

@Ch1nYu Ch1nYu released this 20 Aug 08:48

v1.2.0 unifies the entire cleaning pipeline into background AutoMonitor, removes the redundant Alt+V hotkey and keystroke simulation, and adds single-instance mutex protection.

What changed

1. Unified "Copy-to-Fix" Pipeline (Zero extra keystrokes)

  • Previously, AutoMonitor only performed Dedent, while joining continuations required pressing Alt+V.
  • In v1.2.0, the pipeline is fully unified: whenever you copy text, AutoMonitor automatically runs the complete normalization (Dedent + margin repair + continuation joining) within 300ms in the background.
  • You can simply use standard Ctrl+V or mouse right-click to paste into WezTerm, Windows Terminal, or any application.

2. Removed Alt+V Hotkey & Window-Class Paste Simulation

  • Eliminated global hotkey registration (WM_HOTKEY) and SendInput keystroke injection.
  • No more hotkey collisions with other applications, no stuck modifier keys, and zero accidental keystroke side-effects.
  • Simplified settings.json to a single toggle: AutoMonitor.

3. Single-Instance Mutex Protection

  • Added a named system mutex (PasteFix_App_SingleInstance_Mutex) to prevent multiple background instances from running simultaneously and competing for clipboard events.

4. Reverse-Paste Root Cause & Resolution

  • Investigated and resolved the multi-line reverse paste issue in PowerShell on Windows:
    • Cause: Setting canonicalize_pasted_newlines = "LineFeed" in terminal emulators (e.g. WezTerm) forces raw \n characters into the Windows ConPTY pipeline, causing PSReadLine asynchronous continuation parsers to process multi-line streams in reverse order.
    • Solution: Retain native Windows line breaks (CRLF / CR) to ensure strictly ordered, non-inverting execution.

Install

Unchanged — run PasteFix.exe, self-contained single file, ~51 MB, not code-signed (SmartScreen: More info → Run anyway).

Pastefix v1.0.0

Choose a tag to compare

@Ch1nYu Ch1nYu released this 09 Aug 17:59

Makes a multi-line command copied from a chat window pasteable into a terminal
in one go.
A small Windows tray app that does two things and nothing else.

What it does

1. Removes the indent common to every line. Relative indentation is kept, so
Python, YAML and here-strings survive.

    if (x) {                 if (x) {
        y = 1        →           y = 1
    }                        }

2. Joins continuation lines. A trailing \, backtick, && or | is
consumed and the lines are glued into one command.

docker run \
    -e FOO=bar \      →    docker run -e FOO=bar image
    image

It also repairs a selection that missed the left margin — where line 1 came out
flush and every line below it carries two extra spaces — but only when line 1 is
a finished statement, so that the indent below has no grammar left to justify it.

Install

Download PasteFix.exe and run it. It sits in the notification area; there is no
installer and nothing is written outside %APPDATA%\PasteFix.

  • Windows 10/11, x64. Self-contained: the .NET runtime is inside the exe, so
    nothing needs installing first. That is why the download is ~49 MB.
  • The exe is not code-signed, so Windows SmartScreen will warn on first run —
    More info → Run anyway. Signing needs a paid certificate this project does
    not have. Verify the checksum below if that matters to you, and note that the
    exe's ProductVersion records the exact commit it was built from.

Using it

Surface What it runs Default
全自動監聽 (auto monitor) Dedent, on every clipboard change on
Alt+V Dedent + margin repair + join, then pastes on
立即清洗 (tray item, or double-click the icon) the same, without pasting —

Auto monitor only ever dedents, which cannot change the structure of anything, so
an ordinary Ctrl+V already benefits. Everything that rewrites text waits for
Alt+V. Copying a multi-line block out of a chat window? Use Alt+V.

Both toggles are in the tray menu and persist to
%APPDATA%\PasteFix\settings.json.

What it deliberately does not do

No line-ending rewriting, no prompt stripping ($ , PS C:\>), no comment
deletion, no markdown fence removal, and no guessing whether a block "looks like
a command". Each of those existed once and was removed for a recorded reason —
see docs/records/PLAN-2026-08-09.md.

Known limitations

  • The margin repair is not sound. A YAML multi-line plain scalar (- a /
    b) has meaningful indentation with nothing opening it above, so it gets
    rewritten. This is a deliberate trade, and a test asserts the damage rather
    than hiding it.
  • Copying from the Claude Code terminal UI leaves two spaces on every line
    but the first. Alt+V handles it; plain Ctrl+V cannot, because what every line
    shares is then nothing.
  • Verified on WezTerm and Windows Terminal with PowerShell 7.6 on Windows 11.
    conhost and non-PowerShell shells are untested — not unsupported, just
    unmeasured.

Not solved

Pasting into PowerShell can still execute lines in the wrong order. That
corruption happens after the clipboard is read, so this program cannot reach
it. tools/paste-probe.ps1 is kept as the instrument for measuring it.

Documentation

PasteFix/README.md is the documentation of record. The dated files in
docs/records/ are the account of how the design got here, including the bug
report that caused five rules to be deleted and one acceptance criterion that was
not met.

Checksum

SHA256  1ed5600230877cc966046c5bbdf57c3b5afb9296d887679920ffd24053b83f8d