Skip to content

Repository files navigation

English · 한국어 · 日本語 · 简体中文 · 繁體中文

Cursor CLI prompt with Korean and English text

cursor-cli-input-patch

Unicode input fixes for Cursor CLI
word navigation · blank-line scroll · local · reversible · unofficial

MIT macOS Unofficial Python 3


Naming: The product is Cursor CLI. You run agent (cursor-agent is a legacy alias). This repo patches your local install — it does not ship Cursor binaries.

Before

In the agent prompt, two things feel wrong:

  • Option/Alt + ← / → (macOS) or Ctrl + ← / → (Windows/Linux) only treats [A-Za-z0-9_] as “word” characters and skips the rest
  • onto a blank line above a soft-wrapped URL/path scrolls away and snaps the caret to the wrapped row

After

Same keys, predictable behavior:

  • Word jump uses Intl.Segmenter (granularity: "word", runtime default locale)
  • Blank lines and wrap end-of-line map to the correct visual row — no scroll jump

Blank-line navigation: stock vs patched


Who is affected?

Not CJK-only — the two fixes have different scopes:

Fix Affected users
Option/Ctrl + ← / → Text with characters outside [A-Za-z0-9_] — Korean, Japanese, Chinese, Cyrillic, Arabic, Hebrew, Thai, Greek, Devanagari, Latin with accents (café), etc. Mostly fine for plain ASCII English. Same class of bug in other TUIs (Codex CLI, Claude Code).
↑ on a blank line above a wrapped row Language-agnostic — long URLs, file paths, or any soft-wrapped line with empty rows above.

Built around Korean/CJK pain points; the word-motion patch helps any script the stock ASCII regex skips.


Quick start

git clone https://github.com/vzts/cursor-cli-input-patch.git
cd cursor-cli-input-patch

python3 tests/test_behavior.py   # no Cursor install needed
python3 apply_patch.py           # latest CLI + IDE worker
python3 apply_patch.py --install # optional: zsh hook (see below)

Restart agent (or cursor-agent if you still use that alias) after patching.

Requirements
  • Python 3 — runs the patcher
  • Node.jsnode --check before writing
  • macOS — install paths (especially the IDE worker copy) match Cursor’s layout today
  • Cursor CLI — already installed: curl https://cursor.com/install -fsS | bash
  • --installzsh only (writes ~/.zshrc). Bash/fish: run python3 apply_patch.py manually or wrap agent yourself.

What it patches

Only 4794.index.js — the text-input bundle in your existing install.

Word motion ASCII-only helpers → Intl.Segmenter for Option/Ctrl + arrow
Empty lines findLine fix — blank rows and wrap EOL no longer fall back to line 0

Auto-targets (on-disk paths still use the cursor-agent name):

~/.local/share/cursor-agent/versions/<latest>/
~/Library/Application Support/Cursor/.../cursor-agent-worker/.../versions/<latest>/

Use --no-worker to patch the CLI copy only.


What it deliberately skips

Area Reason
Plain ← / → NFC Hangul is already one UTF-16 code unit per syllable; no patch needed
Backspace / Delete (grapheme) Same
CJK display-width ↑ / ↓ Terminal caret is 1 column per code point; width-2 math lands on the wrong glyph
IME candidate window An older reposition patch hung agent — removed and refused

The patcher never moves the terminal cursor with escape sequences.


Commands

python3 apply_patch.py              # patch CLI + worker
python3 apply_patch.py --install    # zsh hook → auto-patch before `agent`
python3 apply_patch.py --ensure     # quiet if done; warn and exit 0 on mismatch
python3 apply_patch.py --restore    # rollback from .orig.bak
python3 apply_patch.py --list-backups
python3 apply_patch.py --dry-run -v # preview / verbose
python3 apply_patch.py --no-worker  # CLI only
After a CLI update · backups · reinstall

Cursor updates replace the version folder. Re-run python3 apply_patch.py, or launch agent if --install is set.

Backups — one pristine original per version, never overwritten:

~/.local/share/cursor-cli-input-patch/backups/*.orig.bak

Older clones used ~/.local/share/cursor-agent-cjk-input-patch/backups/ — moved on first run.

If a future minify no longer matches, the patcher fails closed (exits with an error). With --ensure, it prints a warning and still lets agent start. Last resort:

curl https://cursor.com/install -fsS | bash

How it works

flowchart LR
  A[agent launch] --> B{zsh hook?}
  B -->|yes| C[apply_patch.py --ensure]
  B -->|no| D[manual run]
  C --> E[find 4794.index.js]
  D --> E
  E --> F[replace pinned snippets]
  F --> G{node --check}
  G -->|ok| H[write + backup]
  G -->|fail| I[rollback]
Loading

Patterns are pinned to a specific minified shape — the patcher refuses to guess if Cursor re-minifies differently.


Tests

python3 tests/test_behavior.py    # portable; no Cursor install
python3 tests/test_pty_arrows.py  # live TUI over PTY; needs patched CLI + `agent` on PATH

Unofficial · not affiliated with Cursor · MIT © 2026 vzts

About

Unofficial local patcher for Cursor CLI — Unicode word navigation and blank-line input fixes

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages