English · 한국어 · 日本語 · 简体中文 · 繁體中文
Unicode input fixes for Cursor CLI
word navigation · blank-line scroll · local · reversible · unofficial
Naming: The product is Cursor CLI. You run
agent(cursor-agentis a legacy alias). This repo patches your local install — it does not ship Cursor binaries.
|
In the
|
Same keys, predictable behavior:
|
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.
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.js —
node --checkbefore 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 --install— zsh only (writes~/.zshrc). Bash/fish: runpython3 apply_patch.pymanually or wrapagentyourself.
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.
| 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.
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 onlyAfter 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 | bashflowchart 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]
Patterns are pinned to a specific minified shape — the patcher refuses to guess if Cursor re-minifies differently.
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
