jeo-code 0.7.24 → 0.7.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/README.ja.md +1 -1
- package/README.ko.md +1 -1
- package/README.md +1 -1
- package/README.zh.md +1 -1
- package/package.json +1 -1
- package/src/commands/launch/input.ts +37 -1
- package/src/commands/launch.ts +22 -3
- package/src/tui/components/input-box.ts +27 -0
- package/src/tui/terminal.ts +35 -0
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
6
6
|
|
|
7
7
|
The README mirrors the latest 5 entries — regenerate with `bun run changelog:sync`.
|
|
8
8
|
|
|
9
|
+
## [0.7.25] - 2026-07-02
|
|
10
|
+
_Shift+Enter now reliably distinguishable from Enter on kitty/WezTerm/iTerm2/xterm via modifyOtherKeys + kitty keyboard protocol; row-aware Home/End and Cmd+Left/Right in multi-row drafts._
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- **modifyOtherKeys + kitty keyboard protocol on launch.** `enableModifyOtherKeys()` (`CSI >4;2m`) and `enableKittyKeyboard()` (`CSI >1u`) are sent to the terminal at REPL startup so Shift+Enter is distinguishable from plain Enter on every modern terminal that supports either protocol. Terminals that support neither silently ignore both sequences. Both modes are restored to defaults (`CSI >4;0m` / `CSI >0u`) on process exit via `process.once("exit", …)`. Four new exports in `src/tui/terminal.ts`: `enableModifyOtherKeys`, `disableModifyOtherKeys`, `enableKittyKeyboard`, `disableKittyKeyboard`.
|
|
14
|
+
- **Row-aware Home/End (and macOS Cmd+Left/Right) in multi-row input.** `ROW_HOME_SEQS` / `ROW_END_SEQS` sequences are now caught by `filterPromptInputChunk` _before_ the old whole-buffer `CURSOR_COMBO_REWRITES` path. `rowBoundaryOffset()` (new export in `input-box.ts`) walks the same `caretCells` grid as vertical navigation and jumps the caret to the start/end of the current **visual row**, degenerating to `0`/`length` on a single-row draft — matching macOS/editor convention of "start/end of THIS line".
|
|
15
|
+
|
|
16
|
+
### Verified
|
|
17
|
+
- `bun run typecheck` clean; full suite green — 2073 pass / 0 fail across 239 files — including two new test files: `test/row-boundary.test.ts` (9 cases for `rowBoundaryOffset`) and `test/row-home-end-filter.test.ts` (5 cases for filter-level row-aware Home/End).
|
|
18
|
+
|
|
9
19
|
## [0.7.24] - 2026-07-02
|
|
10
20
|
_OAuth callback page redesign with embedded jeo wordmark + Close button; memory budget O(n²)→O(n) incremental tracking fix._
|
|
11
21
|
|
package/README.ja.md
CHANGED
|
@@ -205,11 +205,11 @@ CI は `.github/workflows/npm-publish.yml` で公開します — GitHub リリ
|
|
|
205
205
|
## 変更履歴 (Changelog)
|
|
206
206
|
|
|
207
207
|
<!-- CHANGELOG:START (auto-generated from CHANGELOG.md — run `bun run changelog:sync`) -->
|
|
208
|
+
- **[0.7.25]** (2026-07-02) — Shift+Enter now reliably distinguishable from Enter on kitty/WezTerm/iTerm2/xterm via modifyOtherKeys + kitty keyboard protocol; row-aware Home/End and Cmd+Left/Right in multi-row drafts.
|
|
208
209
|
- **[0.7.24]** (2026-07-02) — OAuth callback page redesign with embedded jeo wordmark + Close button; memory budget O(n²)→O(n) incremental tracking fix.
|
|
209
210
|
- **[0.7.23]** (2026-07-01) — Anthropic 5th-generation model catalog: adds Sonnet 5, Fable 5, and Mythos 5, promotes the 4.6 generation to 1M context / 128k output, and retires the superseded 4.5/3.5/4.1 ids. Bumps the default model to Sonnet 4.6, prices the new tiers, and fixes the thinking transport for Haiku 4.5 and every 5th-gen model.
|
|
210
211
|
- **[0.7.22]** (2026-06-30) — gajae-code 0.7.3–0.7.8 parity sweep: terminal-bell notifications, a gruvbox-dark TUI theme, a resilient `jeo update` runtime check, and an ultragoal artifact gate. Ports the user-facing improvements from upstream gajae-code that jeo did not yet have, re-implemented to fit jeo's config, command, theming, and skill surfaces.
|
|
211
212
|
- **[0.7.21]** (2026-06-26) — Global llm-wiki vault integration, Gemini/Antigravity thinking indicators, generous file-reading windows, and autopilot flag validation. Adds a shared global wiki root configuration with a /wiki slash command, fires reasoning start signals up front for Gemini/Antigravity models, adjusts the large-file reading discipline to use generous windows, and validates autopilot goal and integer flags.
|
|
212
|
-
- **[0.7.20]** (2026-06-26) — OKF concept-memory retrieval gains a hybrid reranker ported from memsearch. Injection priority no longer rides one raw keyword score — it fuses two complementary ranked channels by Reciprocal Rank Fusion (RRF): IDF-weighted lexical relevance (the sparse/BM25 channel, so rare discriminating terms steer recall) and concept-graph proximity (the local dense/semantic-neighbour channel, so a hub linked from multiple query hits surfaces even with no keyword of its own). All embedding-free and deterministic, layered atop the existing failure-first tier and pinned-invariant reserved budget.
|
|
213
213
|
|
|
214
214
|
See [CHANGELOG.md](CHANGELOG.md) for the full history.
|
|
215
215
|
<!-- CHANGELOG:END -->
|
package/README.ko.md
CHANGED
|
@@ -205,11 +205,11 @@ CI는 `.github/workflows/npm-publish.yml`로 배포합니다 — GitHub 릴리
|
|
|
205
205
|
## 변경 이력 (Changelog)
|
|
206
206
|
|
|
207
207
|
<!-- CHANGELOG:START (auto-generated from CHANGELOG.md — run `bun run changelog:sync`) -->
|
|
208
|
+
- **[0.7.25]** (2026-07-02) — Shift+Enter now reliably distinguishable from Enter on kitty/WezTerm/iTerm2/xterm via modifyOtherKeys + kitty keyboard protocol; row-aware Home/End and Cmd+Left/Right in multi-row drafts.
|
|
208
209
|
- **[0.7.24]** (2026-07-02) — OAuth callback page redesign with embedded jeo wordmark + Close button; memory budget O(n²)→O(n) incremental tracking fix.
|
|
209
210
|
- **[0.7.23]** (2026-07-01) — Anthropic 5th-generation model catalog: adds Sonnet 5, Fable 5, and Mythos 5, promotes the 4.6 generation to 1M context / 128k output, and retires the superseded 4.5/3.5/4.1 ids. Bumps the default model to Sonnet 4.6, prices the new tiers, and fixes the thinking transport for Haiku 4.5 and every 5th-gen model.
|
|
210
211
|
- **[0.7.22]** (2026-06-30) — gajae-code 0.7.3–0.7.8 parity sweep: terminal-bell notifications, a gruvbox-dark TUI theme, a resilient `jeo update` runtime check, and an ultragoal artifact gate. Ports the user-facing improvements from upstream gajae-code that jeo did not yet have, re-implemented to fit jeo's config, command, theming, and skill surfaces.
|
|
211
212
|
- **[0.7.21]** (2026-06-26) — Global llm-wiki vault integration, Gemini/Antigravity thinking indicators, generous file-reading windows, and autopilot flag validation. Adds a shared global wiki root configuration with a /wiki slash command, fires reasoning start signals up front for Gemini/Antigravity models, adjusts the large-file reading discipline to use generous windows, and validates autopilot goal and integer flags.
|
|
212
|
-
- **[0.7.20]** (2026-06-26) — OKF concept-memory retrieval gains a hybrid reranker ported from memsearch. Injection priority no longer rides one raw keyword score — it fuses two complementary ranked channels by Reciprocal Rank Fusion (RRF): IDF-weighted lexical relevance (the sparse/BM25 channel, so rare discriminating terms steer recall) and concept-graph proximity (the local dense/semantic-neighbour channel, so a hub linked from multiple query hits surfaces even with no keyword of its own). All embedding-free and deterministic, layered atop the existing failure-first tier and pinned-invariant reserved budget.
|
|
213
213
|
|
|
214
214
|
See [CHANGELOG.md](CHANGELOG.md) for the full history.
|
|
215
215
|
<!-- CHANGELOG:END -->
|
package/README.md
CHANGED
|
@@ -232,11 +232,11 @@ Huge thanks to [gajae-code](https://github.com/Yeachan-Heo/gajae-code) for the i
|
|
|
232
232
|
## Changelog
|
|
233
233
|
|
|
234
234
|
<!-- CHANGELOG:START (auto-generated from CHANGELOG.md — run `bun run changelog:sync`) -->
|
|
235
|
+
- **[0.7.25]** (2026-07-02) — Shift+Enter now reliably distinguishable from Enter on kitty/WezTerm/iTerm2/xterm via modifyOtherKeys + kitty keyboard protocol; row-aware Home/End and Cmd+Left/Right in multi-row drafts.
|
|
235
236
|
- **[0.7.24]** (2026-07-02) — OAuth callback page redesign with embedded jeo wordmark + Close button; memory budget O(n²)→O(n) incremental tracking fix.
|
|
236
237
|
- **[0.7.23]** (2026-07-01) — Anthropic 5th-generation model catalog: adds Sonnet 5, Fable 5, and Mythos 5, promotes the 4.6 generation to 1M context / 128k output, and retires the superseded 4.5/3.5/4.1 ids. Bumps the default model to Sonnet 4.6, prices the new tiers, and fixes the thinking transport for Haiku 4.5 and every 5th-gen model.
|
|
237
238
|
- **[0.7.22]** (2026-06-30) — gajae-code 0.7.3–0.7.8 parity sweep: terminal-bell notifications, a gruvbox-dark TUI theme, a resilient `jeo update` runtime check, and an ultragoal artifact gate. Ports the user-facing improvements from upstream gajae-code that jeo did not yet have, re-implemented to fit jeo's config, command, theming, and skill surfaces.
|
|
238
239
|
- **[0.7.21]** (2026-06-26) — Global llm-wiki vault integration, Gemini/Antigravity thinking indicators, generous file-reading windows, and autopilot flag validation. Adds a shared global wiki root configuration with a /wiki slash command, fires reasoning start signals up front for Gemini/Antigravity models, adjusts the large-file reading discipline to use generous windows, and validates autopilot goal and integer flags.
|
|
239
|
-
- **[0.7.20]** (2026-06-26) — OKF concept-memory retrieval gains a hybrid reranker ported from memsearch. Injection priority no longer rides one raw keyword score — it fuses two complementary ranked channels by Reciprocal Rank Fusion (RRF): IDF-weighted lexical relevance (the sparse/BM25 channel, so rare discriminating terms steer recall) and concept-graph proximity (the local dense/semantic-neighbour channel, so a hub linked from multiple query hits surfaces even with no keyword of its own). All embedding-free and deterministic, layered atop the existing failure-first tier and pinned-invariant reserved budget.
|
|
240
240
|
|
|
241
241
|
See [CHANGELOG.md](CHANGELOG.md) for the full history.
|
|
242
242
|
<!-- CHANGELOG:END -->
|
package/README.zh.md
CHANGED
|
@@ -205,11 +205,11 @@ CI 通过 `.github/workflows/npm-publish.yml` 发布 — GitHub 发布 release
|
|
|
205
205
|
## 更新日志 (Changelog)
|
|
206
206
|
|
|
207
207
|
<!-- CHANGELOG:START (auto-generated from CHANGELOG.md — run `bun run changelog:sync`) -->
|
|
208
|
+
- **[0.7.25]** (2026-07-02) — Shift+Enter now reliably distinguishable from Enter on kitty/WezTerm/iTerm2/xterm via modifyOtherKeys + kitty keyboard protocol; row-aware Home/End and Cmd+Left/Right in multi-row drafts.
|
|
208
209
|
- **[0.7.24]** (2026-07-02) — OAuth callback page redesign with embedded jeo wordmark + Close button; memory budget O(n²)→O(n) incremental tracking fix.
|
|
209
210
|
- **[0.7.23]** (2026-07-01) — Anthropic 5th-generation model catalog: adds Sonnet 5, Fable 5, and Mythos 5, promotes the 4.6 generation to 1M context / 128k output, and retires the superseded 4.5/3.5/4.1 ids. Bumps the default model to Sonnet 4.6, prices the new tiers, and fixes the thinking transport for Haiku 4.5 and every 5th-gen model.
|
|
210
211
|
- **[0.7.22]** (2026-06-30) — gajae-code 0.7.3–0.7.8 parity sweep: terminal-bell notifications, a gruvbox-dark TUI theme, a resilient `jeo update` runtime check, and an ultragoal artifact gate. Ports the user-facing improvements from upstream gajae-code that jeo did not yet have, re-implemented to fit jeo's config, command, theming, and skill surfaces.
|
|
211
212
|
- **[0.7.21]** (2026-06-26) — Global llm-wiki vault integration, Gemini/Antigravity thinking indicators, generous file-reading windows, and autopilot flag validation. Adds a shared global wiki root configuration with a /wiki slash command, fires reasoning start signals up front for Gemini/Antigravity models, adjusts the large-file reading discipline to use generous windows, and validates autopilot goal and integer flags.
|
|
212
|
-
- **[0.7.20]** (2026-06-26) — OKF concept-memory retrieval gains a hybrid reranker ported from memsearch. Injection priority no longer rides one raw keyword score — it fuses two complementary ranked channels by Reciprocal Rank Fusion (RRF): IDF-weighted lexical relevance (the sparse/BM25 channel, so rare discriminating terms steer recall) and concept-graph proximity (the local dense/semantic-neighbour channel, so a hub linked from multiple query hits surfaces even with no keyword of its own). All embedding-free and deterministic, layered atop the existing failure-first tier and pinned-invariant reserved budget.
|
|
213
213
|
|
|
214
214
|
See [CHANGELOG.md](CHANGELOG.md) for the full history.
|
|
215
215
|
<!-- CHANGELOG:END -->
|
package/package.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { verticalCursorOffset } from "../../tui/components/input-box";
|
|
1
|
+
import { verticalCursorOffset, rowBoundaryOffset } from "../../tui/components/input-box";
|
|
2
|
+
|
|
2
3
|
|
|
3
4
|
export interface InFlightAbortHarness {
|
|
4
5
|
controller: AbortController;
|
|
@@ -556,6 +557,17 @@ export function decideCtrlC(
|
|
|
556
557
|
* `modifyOtherKeys` form (`CSI 27;2;13~`) and the kitty keyboard-protocol form
|
|
557
558
|
* (`CSI 13;2u`). Shared by the live input filter and its tests so they can't drift. */
|
|
558
559
|
export const SHIFT_ENTER_SEQS: readonly string[] = ["\u001b[27;2;13~", "\u001b[13;2u"];
|
|
560
|
+
/** Sequences that should jump the caret to the START of the current VISUAL ROW: macOS
|
|
561
|
+
* Cmd+Left (`CSI 1;9D`) and the platform-neutral Home key in both its xterm (`CSI H`)
|
|
562
|
+
* and vt220 (`CSI 1~`) forms, plus the SS3 variant (`ESC O H`) some terminals send in
|
|
563
|
+
* application-cursor-keys mode. Windows terminals have no Cmd-combo equivalent — bare
|
|
564
|
+
* Home is the "적절한 윈도우 단축키" for this action, so it must get the SAME row-aware
|
|
565
|
+
* treatment as Cmd+Left, not just readline's native (whole-buffer) binding. */
|
|
566
|
+
export const ROW_HOME_SEQS: readonly string[] = ["\u001b[1;9D", "\u001b[H", "\u001b[1~", "\u001bOH"];
|
|
567
|
+
/** Mirror of {@link ROW_HOME_SEQS} for the END of the current visual row: macOS
|
|
568
|
+
* Cmd+Right (`CSI 1;9C`) and the xterm/vt220/SS3 End key forms. */
|
|
569
|
+
export const ROW_END_SEQS: readonly string[] = ["\u001b[1;9C", "\u001b[F", "\u001b[4~", "\u001bOF"];
|
|
570
|
+
|
|
559
571
|
|
|
560
572
|
/** Minimal readline view the prompt key-filter reads (and mutates `cursor` on a
|
|
561
573
|
* vertical-nav "move"). The live filter passes the real readline interface; tests
|
|
@@ -697,6 +709,30 @@ export function filterPromptInputChunk(
|
|
|
697
709
|
if (data.startsWith(seq, i)) { out += MULTILINE_SENTINEL; i += seq.length; matched = true; break; }
|
|
698
710
|
}
|
|
699
711
|
if (matched) continue;
|
|
712
|
+
// Row-aware Home/End: macOS Cmd+Left/Right and the bare Home/End keys (the Windows/
|
|
713
|
+
// Linux equivalent — there is no Cmd-combo there) jump to the START/END of the
|
|
714
|
+
// CURRENT VISUAL ROW, not the whole buffer. Native readline binds these to
|
|
715
|
+
// beginning-of-line/end-of-line, which is only correct on a single-row draft; on a
|
|
716
|
+
// multi-row draft (Shift+Enter breaks or box soft-wrap) it overshoots past the
|
|
717
|
+
// current row. Checked BEFORE `matchCursorCombo` (which would otherwise rewrite
|
|
718
|
+
// Cmd+Left/Right to the whole-buffer Ctrl+A/E) so this always wins when `rl` can
|
|
719
|
+
// supply a cursor to compute from; without `rl` it falls through to that rewrite
|
|
720
|
+
// (or, for bare Home/End, straight to readline's native binding) as a safe degrade.
|
|
721
|
+
const rowEdge = ROW_HOME_SEQS.find(seq => data.startsWith(seq, i)) !== undefined ? "start"
|
|
722
|
+
: ROW_END_SEQS.find(seq => data.startsWith(seq, i)) !== undefined ? "end"
|
|
723
|
+
: undefined;
|
|
724
|
+
if (rowEdge && rl) {
|
|
725
|
+
const seq = (rowEdge === "start" ? ROW_HOME_SEQS : ROW_END_SEQS).find(s => data.startsWith(s, i))!;
|
|
726
|
+
const line = rl.line ?? "";
|
|
727
|
+
const winCols = Math.max(24, env.columns - 1);
|
|
728
|
+
const textWidth = Math.max(1, Math.max(24, winCols) - 6);
|
|
729
|
+
const cur = typeof rl.cursor === "number" ? rl.cursor : line.length;
|
|
730
|
+
const expanded = line.split(MULTILINE_SENTINEL).join("\n");
|
|
731
|
+
rl.cursor = rowBoundaryOffset(expanded, cur, textWidth, rowEdge);
|
|
732
|
+
i += seq.length;
|
|
733
|
+
continue;
|
|
734
|
+
}
|
|
735
|
+
|
|
700
736
|
const combo = matchCursorCombo(data, i);
|
|
701
737
|
if (combo) { out += combo[1]; i += combo[0].length; continue; }
|
|
702
738
|
// Up/Down between the box's visual rows (textarea feel) for any MULTI-ROW draft;
|
package/src/commands/launch.ts
CHANGED
|
@@ -101,7 +101,8 @@ import {
|
|
|
101
101
|
sessionPath,
|
|
102
102
|
appendCompaction,
|
|
103
103
|
} from "../agent/session";
|
|
104
|
-
import { clearLine, cursorUp, toColumn, truncate as truncateAnsi, size as terminalSize, resetMouseTracking, clearScreen, clearVisible, clearToEnd } from "../tui/terminal";
|
|
104
|
+
import { clearLine, cursorUp, toColumn, truncate as truncateAnsi, size as terminalSize, resetMouseTracking, clearScreen, clearVisible, clearToEnd, enableModifyOtherKeys, disableModifyOtherKeys, enableKittyKeyboard, disableKittyKeyboard } from "../tui/terminal";
|
|
105
|
+
|
|
105
106
|
|
|
106
107
|
import {
|
|
107
108
|
type LaunchFlags,
|
|
@@ -1563,7 +1564,19 @@ export async function runLaunchCommand(args: string[]): Promise<void> {
|
|
|
1563
1564
|
// 'keypress' too so the footer-redraw / paste-marker / picker listeners (registered
|
|
1564
1565
|
// on process.stdin below) still fire.
|
|
1565
1566
|
emitKeypressEvents(process.stdin);
|
|
1567
|
+
// Ask the terminal to make Shift+Enter DISTINGUISHABLE from plain Enter — without
|
|
1568
|
+
// this, `SHIFT_ENTER_SEQS`/the lone-LF opt-in never see anything to match, because
|
|
1569
|
+
// most terminals send NOTHING (or a byte identical to Enter) for Shift+Enter unless
|
|
1570
|
+
// one of these protocols is explicitly requested. Both are safe to send unconditionally:
|
|
1571
|
+
// a terminal that doesn't implement either silently ignores the unrecognized private-mode
|
|
1572
|
+
// sequence. Restored on exit so a shell/editor started afterward isn't left with an
|
|
1573
|
+
// unexpected keyboard-encoding mode.
|
|
1574
|
+
process.stdout.write(enableModifyOtherKeys() + enableKittyKeyboard());
|
|
1575
|
+
process.once("exit", () => {
|
|
1576
|
+
try { process.stdout.write(disableKittyKeyboard() + disableModifyOtherKeys()); } catch { /* terminal gone */ }
|
|
1577
|
+
});
|
|
1566
1578
|
}
|
|
1579
|
+
|
|
1567
1580
|
const rl = createInterface({
|
|
1568
1581
|
input: keyFilter ?? process.stdin,
|
|
1569
1582
|
// Single-box input: gate readline's output while the boxed footer is armed so its own
|
|
@@ -2825,17 +2838,23 @@ export async function runLaunchCommand(args: string[]): Promise<void> {
|
|
|
2825
2838
|
})();
|
|
2826
2839
|
return;
|
|
2827
2840
|
}
|
|
2828
|
-
if (previewPending) return;
|
|
2829
2841
|
// ESC (or a meta-mapped Cmd+C) at the prompt: wipe the typed text. A bare
|
|
2830
2842
|
// ESC decodes as `escape` (meta is set for a lone ESC byte — accept both)
|
|
2831
2843
|
// only after readline's escape-sequence timeout, so arrow/wheel sequences
|
|
2832
|
-
// never trigger this.
|
|
2844
|
+
// never trigger this. Checked BEFORE the `previewPending` reentrancy gate
|
|
2845
|
+
// (like Ctrl+C above) — a fast typist/paste can deliver several keypress
|
|
2846
|
+
// events in ONE synchronous stdin read, all before the first keystroke's
|
|
2847
|
+
// setImmediate fires; gating this after `previewPending` silently dropped
|
|
2848
|
+
// an ESC that lands in the same burst as preceding keystrokes (the
|
|
2849
|
+
// "esc 입력 후 안 먹힘" bug — Esc right after typing intermittently did nothing).
|
|
2833
2850
|
if (key && ((key.name === "escape" && !key.ctrl) || (key.meta && key.name === "c"))) {
|
|
2834
2851
|
clearTypedInput();
|
|
2835
2852
|
return;
|
|
2836
2853
|
}
|
|
2854
|
+
if (previewPending) return;
|
|
2837
2855
|
// Ctrl+C is handled above (clear-or-exit); keep this guard for defensive ordering only.
|
|
2838
2856
|
if (key?.ctrl && key.name === "c") return;
|
|
2857
|
+
|
|
2839
2858
|
previewPending = true;
|
|
2840
2859
|
setImmediate(() => {
|
|
2841
2860
|
previewPending = false;
|
|
@@ -242,3 +242,30 @@ export function verticalCursorOffset(
|
|
|
242
242
|
}
|
|
243
243
|
return best !== -1 ? best : firstOnRow;
|
|
244
244
|
}
|
|
245
|
+
/** Caret offset at the START or END of the VISUAL ROW containing `cursor`, using the
|
|
246
|
+
* SAME wrapping rule as the input box (`caretCells`/`wrapWithCursor`). This is the
|
|
247
|
+
* row-aware counterpart to Home/End (and macOS Cmd+Left/Right): on a single-row draft
|
|
248
|
+
* it degenerates to the whole buffer's start/end (0 / length), but on a multi-row draft
|
|
249
|
+
* (Shift+Enter hard breaks OR a long line the box soft-wraps) it stops at the CURRENT
|
|
250
|
+
* row's boundary instead of jumping past other rows — matching the platform convention
|
|
251
|
+
* (macOS Cmd+←/→, editors' Home/End) of "start/end of THIS line", not "start/end of the
|
|
252
|
+
* whole document". */
|
|
253
|
+
export function rowBoundaryOffset(
|
|
254
|
+
text: string,
|
|
255
|
+
cursor: number,
|
|
256
|
+
width: number,
|
|
257
|
+
edge: "start" | "end",
|
|
258
|
+
): number {
|
|
259
|
+
const cells = caretCells(text, Math.max(1, width));
|
|
260
|
+
if (cells.length === 0) return 0;
|
|
261
|
+
const pos = Math.max(0, Math.min(cursor, cells.length - 1));
|
|
262
|
+
const row = cells[pos]!.row;
|
|
263
|
+
let start = pos;
|
|
264
|
+
let end = pos;
|
|
265
|
+
for (let p = 0; p < cells.length; p++) {
|
|
266
|
+
if (cells[p]!.row !== row) continue;
|
|
267
|
+
if (p < start) start = p;
|
|
268
|
+
if (p > end) end = p;
|
|
269
|
+
}
|
|
270
|
+
return edge === "start" ? start : end;
|
|
271
|
+
}
|
package/src/tui/terminal.ts
CHANGED
|
@@ -100,3 +100,38 @@ export function isTTY(): boolean {
|
|
|
100
100
|
export function truncate(line: string, cols: number): string {
|
|
101
101
|
return truncateToWidth(line, cols);
|
|
102
102
|
}
|
|
103
|
+
/** Request xterm's `modifyOtherKeys` mode 2 (`CSI > 4 ; 2 m`): the terminal starts
|
|
104
|
+
* encoding "inert" combos — Shift+Enter among them — as a full `CSI 27;<mod>;<code>~`
|
|
105
|
+
* sequence instead of sending a byte indistinguishable from plain Enter (or nothing at
|
|
106
|
+
* all). Without this, jeo's Shift+Enter → newline handling (`SHIFT_ENTER_SEQS` in
|
|
107
|
+
* `commands/launch/input.ts`) never actually fires on most terminals — the terminal
|
|
108
|
+
* never emits a sequence to match because nothing asked it to. Terminals that don't
|
|
109
|
+
* implement the mode (Windows Terminal's legacy conpty path, some minimal emulators)
|
|
110
|
+
* silently ignore the unrecognized private-mode sequence — safe to send unconditionally. */
|
|
111
|
+
export function enableModifyOtherKeys(): string {
|
|
112
|
+
return `${ESC}>4;2m`;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** Restore `modifyOtherKeys` to its default (mode 0 — "no special encoding") on exit,
|
|
116
|
+
* the counterpart to {@link enableModifyOtherKeys}. */
|
|
117
|
+
export function disableModifyOtherKeys(): string {
|
|
118
|
+
return `${ESC}>4;0m`;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/** Enable the kitty keyboard protocol's "disambiguate escape codes" flag (bit 1 of
|
|
122
|
+
* `CSI > flags u`): the modern, more widely supported (kitty, wezterm, foot, contour,
|
|
123
|
+
* ghostty, iTerm2, and increasingly Windows Terminal) alternative delivery mechanism
|
|
124
|
+
* for the same Shift+Enter sequence jeo already recognizes (`CSI 13;2u`,
|
|
125
|
+
* `SHIFT_ENTER_SEQS`). Terminals without kitty-protocol support ignore the private-mode
|
|
126
|
+
* `u`-suffixed CSI sequence — safe to send unconditionally alongside
|
|
127
|
+
* {@link enableModifyOtherKeys} so whichever protocol the terminal supports (if either)
|
|
128
|
+
* makes Shift+Enter distinguishable from plain Enter. */
|
|
129
|
+
export function enableKittyKeyboard(): string {
|
|
130
|
+
return `${ESC}>1u`;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/** Reset the kitty keyboard protocol flags to 0 (disabled) on exit, the counterpart to
|
|
134
|
+
* {@link enableKittyKeyboard}. */
|
|
135
|
+
export function disableKittyKeyboard(): string {
|
|
136
|
+
return `${ESC}>0u`;
|
|
137
|
+
}
|