@cnwenf/occ 2.1.307 → 2.1.309
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/dist/cli.js +240 -68
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
globalThis.MACRO={"VERSION":"2.1.
|
|
2
|
+
globalThis.MACRO={"VERSION":"2.1.309","BINARY_NAME":"occ","BUILD_TIME":"2026-08-22T21:04:11.629Z","FEEDBACK_CHANNEL":"","ISSUES_EXPLAINER":"","NATIVE_PACKAGE_URL":"","PACKAGE_URL":"@cnwenf/occ","VERSION_CHANGELOG":""};
|
|
3
3
|
// @bun
|
|
4
4
|
var __create = Object.create;
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
@@ -59651,6 +59651,7 @@ var init_types2 = __esm(() => {
|
|
|
59651
59651
|
tui: exports_external.enum(["default", "fullscreen"]).optional().describe('Terminal UI renderer. "fullscreen" uses the flicker-free alt-screen renderer with virtualized scrollback (equivalent to CLAUDE_CODE_NO_FLICKER=1). "default" uses the classic main-screen renderer.'),
|
|
59652
59652
|
axScreenReader: exports_external.boolean().optional().describe("Render screen-reader friendly output (flat text, no decorative borders or animations). Overridden by the CLAUDE_AX_SCREEN_READER env var and the --ax-screen-reader CLI flag."),
|
|
59653
59653
|
viewMode: exports_external.enum(["default", "verbose", "focus"]).optional().catch(undefined).describe("Default transcript view mode on startup"),
|
|
59654
|
+
keybindingFlavor: exports_external.enum(["classic", "readline"]).optional().catch(undefined).describe(`Which conventions the prompt's editing keys follow: "readline" matches Bash and other readline programs (Ctrl+W deletes back to the previous whitespace); "classic" (default) keeps Claude Code's long-standing behavior (Ctrl+W deletes the previous word)`),
|
|
59654
59655
|
vimInsertModeRemaps: exports_external.record(exports_external.string(), exports_external.unknown()).optional().catch(undefined).describe('Vim INSERT-mode key-sequence remaps, e.g. {"jj": "<Esc>"}. Each key is exactly two printable characters typed in sequence; "<Esc>" (return to NORMAL mode) is the only supported target. Applies when editorMode is "vim".'),
|
|
59655
59656
|
externalEditorContext: exports_external.boolean().optional().describe("Show the last assistant response as commented context above the prompt when opening the external editor (Ctrl+G)."),
|
|
59656
59657
|
prUrlTemplate: exports_external.string().optional().describe('URL template for the footer PR badge (e.g. "https://internal-review.example.com/pr/{number}"). Uses {number} as the PR number placeholder. Defaults to github.com.'),
|
|
@@ -452680,10 +452681,17 @@ var init_ink3 = __esm(() => {
|
|
|
452680
452681
|
});
|
|
452681
452682
|
|
|
452682
452683
|
// src/utils/srA11y.ts
|
|
452683
|
-
function announceDeletedText(deletedText, sink2 = pushScreenReaderAnnouncement) {
|
|
452684
|
-
if (deletedText
|
|
452685
|
-
|
|
452684
|
+
function announceDeletedText(deletedText, mask = "", sink2 = pushScreenReaderAnnouncement) {
|
|
452685
|
+
if (deletedText === "")
|
|
452686
|
+
return;
|
|
452687
|
+
if (mask !== "") {
|
|
452688
|
+
sink2("deleted");
|
|
452689
|
+
return;
|
|
452686
452690
|
}
|
|
452691
|
+
const announcement = deletedText.trim() === "" ? deletedText.includes(`
|
|
452692
|
+
`) ? "new line" : deletedText.includes("\t") ? "tab" : "space" : deletedText.replaceAll(`
|
|
452693
|
+
`, " ").trim();
|
|
452694
|
+
sink2(announcement);
|
|
452687
452695
|
}
|
|
452688
452696
|
function srEchoTypedChar(char) {
|
|
452689
452697
|
if (char === " ") {
|
|
@@ -637445,7 +637453,7 @@ class Cursor {
|
|
|
637445
637453
|
left() {
|
|
637446
637454
|
if (this.offset === 0)
|
|
637447
637455
|
return this;
|
|
637448
|
-
const chip = this.
|
|
637456
|
+
const chip = this.placeholderEndingAt(this.offset);
|
|
637449
637457
|
if (chip)
|
|
637450
637458
|
return new Cursor(this.measuredText, chip.start);
|
|
637451
637459
|
const prevOffset = this.measuredText.prevOffset(this.offset);
|
|
@@ -637454,31 +637462,40 @@ class Cursor {
|
|
|
637454
637462
|
right() {
|
|
637455
637463
|
if (this.offset >= this.text.length)
|
|
637456
637464
|
return this;
|
|
637457
|
-
const chip = this.
|
|
637465
|
+
const chip = this.placeholderStartingAt(this.offset);
|
|
637458
637466
|
if (chip)
|
|
637459
637467
|
return new Cursor(this.measuredText, chip.end);
|
|
637460
637468
|
const nextOffset = this.measuredText.nextOffset(this.offset);
|
|
637461
637469
|
return new Cursor(this.measuredText, Math.min(nextOffset, this.text.length));
|
|
637462
637470
|
}
|
|
637463
|
-
|
|
637464
|
-
|
|
637471
|
+
placeholderEndingAt(offset) {
|
|
637472
|
+
if (this.text[offset - 1] !== "]")
|
|
637473
|
+
return null;
|
|
637474
|
+
const m5 = this.text.slice(0, offset).match(PLACEHOLDER_ENDING_RE);
|
|
637465
637475
|
return m5 ? { start: offset - m5[0].length, end: offset } : null;
|
|
637466
637476
|
}
|
|
637467
|
-
|
|
637468
|
-
|
|
637477
|
+
placeholderStartingAt(offset) {
|
|
637478
|
+
if (this.text[offset] !== "[")
|
|
637479
|
+
return null;
|
|
637480
|
+
const m5 = this.text.slice(offset).match(PLACEHOLDER_STARTING_RE);
|
|
637469
637481
|
return m5 ? { start: offset, end: offset + m5[0].length } : null;
|
|
637470
637482
|
}
|
|
637471
|
-
|
|
637472
|
-
const
|
|
637473
|
-
|
|
637474
|
-
while ((m5 = re3.exec(this.text)) !== null) {
|
|
637475
|
-
const start = m5.index;
|
|
637483
|
+
placeholderContaining(offset) {
|
|
637484
|
+
for (const m5 of this.text.matchAll(PLACEHOLDER_GLOBAL_RE)) {
|
|
637485
|
+
const start = m5.index ?? 0;
|
|
637476
637486
|
const end = start + m5[0].length;
|
|
637477
|
-
if (offset > start && offset < end)
|
|
637478
|
-
return
|
|
637479
|
-
|
|
637487
|
+
if (offset > start && offset < end)
|
|
637488
|
+
return { start, end };
|
|
637489
|
+
if (start >= offset)
|
|
637490
|
+
break;
|
|
637480
637491
|
}
|
|
637481
|
-
return
|
|
637492
|
+
return null;
|
|
637493
|
+
}
|
|
637494
|
+
snapOutOfPlaceholder(offset, toward) {
|
|
637495
|
+
const chip = this.placeholderContaining(offset);
|
|
637496
|
+
if (!chip)
|
|
637497
|
+
return offset;
|
|
637498
|
+
return toward === "start" ? chip.start : chip.end;
|
|
637482
637499
|
}
|
|
637483
637500
|
up() {
|
|
637484
637501
|
const { line, column } = this.getPosition();
|
|
@@ -637614,10 +637631,15 @@ class Cursor {
|
|
|
637614
637631
|
if (this.isAtEnd()) {
|
|
637615
637632
|
return this;
|
|
637616
637633
|
}
|
|
637634
|
+
const chip = this.placeholderStartingAt(this.offset) ?? this.placeholderContaining(this.offset);
|
|
637635
|
+
if (chip) {
|
|
637636
|
+
return new Cursor(this.measuredText, chip.end);
|
|
637637
|
+
}
|
|
637617
637638
|
const wordBoundaries = this.measuredText.getWordBoundaries();
|
|
637618
637639
|
for (const boundary of wordBoundaries) {
|
|
637619
637640
|
if (boundary.isWordLike && boundary.start > this.offset) {
|
|
637620
|
-
|
|
637641
|
+
const target = this.snapOutOfPlaceholder(boundary.start, "end");
|
|
637642
|
+
return new Cursor(this.measuredText, target);
|
|
637621
637643
|
}
|
|
637622
637644
|
}
|
|
637623
637645
|
return new Cursor(this.measuredText, this.text.length);
|
|
@@ -637653,6 +637675,14 @@ class Cursor {
|
|
|
637653
637675
|
if (this.isAtStart()) {
|
|
637654
637676
|
return this;
|
|
637655
637677
|
}
|
|
637678
|
+
const chipEnding = this.placeholderEndingAt(this.offset);
|
|
637679
|
+
if (chipEnding) {
|
|
637680
|
+
return new Cursor(this.measuredText, chipEnding.start);
|
|
637681
|
+
}
|
|
637682
|
+
const chipContaining = this.placeholderContaining(this.offset);
|
|
637683
|
+
if (chipContaining) {
|
|
637684
|
+
return new Cursor(this.measuredText, chipContaining.start);
|
|
637685
|
+
}
|
|
637656
637686
|
const wordBoundaries = this.measuredText.getWordBoundaries();
|
|
637657
637687
|
let prevWordStart = null;
|
|
637658
637688
|
for (const boundary of wordBoundaries) {
|
|
@@ -637660,13 +637690,15 @@ class Cursor {
|
|
|
637660
637690
|
continue;
|
|
637661
637691
|
if (boundary.start < this.offset) {
|
|
637662
637692
|
if (this.offset > boundary.start && this.offset <= boundary.end) {
|
|
637663
|
-
|
|
637693
|
+
const target = this.snapOutOfPlaceholder(boundary.start, "start");
|
|
637694
|
+
return new Cursor(this.measuredText, target);
|
|
637664
637695
|
}
|
|
637665
637696
|
prevWordStart = boundary.start;
|
|
637666
637697
|
}
|
|
637667
637698
|
}
|
|
637668
637699
|
if (prevWordStart !== null) {
|
|
637669
|
-
|
|
637700
|
+
const target = this.snapOutOfPlaceholder(prevWordStart, "start");
|
|
637701
|
+
return new Cursor(this.measuredText, target);
|
|
637670
637702
|
}
|
|
637671
637703
|
return new Cursor(this.measuredText, 0);
|
|
637672
637704
|
}
|
|
@@ -637803,6 +637835,64 @@ class Cursor {
|
|
|
637803
637835
|
}
|
|
637804
637836
|
return cursor;
|
|
637805
637837
|
}
|
|
637838
|
+
forwardWord() {
|
|
637839
|
+
if (this.isAtEnd()) {
|
|
637840
|
+
return this;
|
|
637841
|
+
}
|
|
637842
|
+
const chip = this.placeholderStartingAt(this.offset) ?? this.placeholderContaining(this.offset);
|
|
637843
|
+
if (chip) {
|
|
637844
|
+
return new Cursor(this.measuredText, chip.end);
|
|
637845
|
+
}
|
|
637846
|
+
for (const boundary of this.measuredText.getReadlineWordBoundaries()) {
|
|
637847
|
+
if (boundary.end > this.offset) {
|
|
637848
|
+
const target = this.snapOutOfPlaceholder(boundary.end, "end");
|
|
637849
|
+
return new Cursor(this.measuredText, target);
|
|
637850
|
+
}
|
|
637851
|
+
}
|
|
637852
|
+
return new Cursor(this.measuredText, this.text.length);
|
|
637853
|
+
}
|
|
637854
|
+
backwardWord() {
|
|
637855
|
+
if (this.isAtStart()) {
|
|
637856
|
+
return this;
|
|
637857
|
+
}
|
|
637858
|
+
const chip = this.placeholderEndingAt(this.offset) ?? this.placeholderContaining(this.offset);
|
|
637859
|
+
if (chip) {
|
|
637860
|
+
return new Cursor(this.measuredText, chip.start);
|
|
637861
|
+
}
|
|
637862
|
+
const boundaries = this.measuredText.getReadlineWordBoundaries();
|
|
637863
|
+
for (let i6 = boundaries.length - 1;i6 >= 0; i6--) {
|
|
637864
|
+
const boundary = boundaries[i6];
|
|
637865
|
+
if (boundary.start < this.offset) {
|
|
637866
|
+
const target = this.snapOutOfPlaceholder(boundary.start, "start");
|
|
637867
|
+
return new Cursor(this.measuredText, target);
|
|
637868
|
+
}
|
|
637869
|
+
}
|
|
637870
|
+
return new Cursor(this.measuredText, 0);
|
|
637871
|
+
}
|
|
637872
|
+
killWord() {
|
|
637873
|
+
const target = this.forwardWord();
|
|
637874
|
+
if (target.offset === this.offset) {
|
|
637875
|
+
return { cursor: this, killed: "" };
|
|
637876
|
+
}
|
|
637877
|
+
return this.killRange(this.offset, target.offset);
|
|
637878
|
+
}
|
|
637879
|
+
backwardKillWord() {
|
|
637880
|
+
const target = this.backwardWord();
|
|
637881
|
+
if (target.offset === this.offset) {
|
|
637882
|
+
return { cursor: this, killed: "" };
|
|
637883
|
+
}
|
|
637884
|
+
return this.killRange(target.offset, this.offset);
|
|
637885
|
+
}
|
|
637886
|
+
killRange(start, end) {
|
|
637887
|
+
const snappedStart = this.snapOutOfPlaceholder(start, "start");
|
|
637888
|
+
const snappedEnd = this.snapOutOfPlaceholder(end, "end");
|
|
637889
|
+
const startCursor = new Cursor(this.measuredText, snappedStart);
|
|
637890
|
+
const endCursor = new Cursor(this.measuredText, snappedEnd);
|
|
637891
|
+
return {
|
|
637892
|
+
cursor: startCursor.modifyText(endCursor),
|
|
637893
|
+
killed: this.text.slice(snappedStart, snappedEnd)
|
|
637894
|
+
};
|
|
637895
|
+
}
|
|
637806
637896
|
modifyText(end, insertString = "") {
|
|
637807
637897
|
const startOffset = this.offset;
|
|
637808
637898
|
const endOffset = end.offset;
|
|
@@ -637832,8 +637922,7 @@ class Cursor {
|
|
|
637832
637922
|
` };
|
|
637833
637923
|
}
|
|
637834
637924
|
const startCursor = this.startOfLine();
|
|
637835
|
-
|
|
637836
|
-
return { cursor: startCursor.modifyText(this), killed };
|
|
637925
|
+
return this.killRange(startCursor.offset, this.offset);
|
|
637837
637926
|
}
|
|
637838
637927
|
deleteToLineEnd() {
|
|
637839
637928
|
if (this.text[this.offset] === `
|
|
@@ -637842,27 +637931,29 @@ class Cursor {
|
|
|
637842
637931
|
` };
|
|
637843
637932
|
}
|
|
637844
637933
|
const endCursor = this.endOfLine();
|
|
637845
|
-
|
|
637846
|
-
return { cursor: this.modifyText(endCursor), killed };
|
|
637934
|
+
return this.killRange(this.offset, endCursor.offset);
|
|
637847
637935
|
}
|
|
637848
637936
|
deleteToLogicalLineEnd() {
|
|
637849
637937
|
if (this.text[this.offset] === `
|
|
637850
637938
|
`) {
|
|
637851
637939
|
return this.modifyText(this.right());
|
|
637852
637940
|
}
|
|
637853
|
-
return this.
|
|
637941
|
+
return this.killRange(this.offset, this.endOfLogicalLine().offset).cursor;
|
|
637854
637942
|
}
|
|
637855
637943
|
deleteWordBefore() {
|
|
637856
637944
|
if (this.isAtStart()) {
|
|
637857
637945
|
return { cursor: this, killed: "" };
|
|
637858
637946
|
}
|
|
637859
|
-
|
|
637860
|
-
|
|
637861
|
-
|
|
637862
|
-
|
|
637947
|
+
return this.killRange(this.prevWord().offset, this.offset);
|
|
637948
|
+
}
|
|
637949
|
+
deleteWORDBefore() {
|
|
637950
|
+
if (this.isAtStart()) {
|
|
637951
|
+
return { cursor: this, killed: "" };
|
|
637952
|
+
}
|
|
637953
|
+
return this.killRange(this.prevWORD().offset, this.offset);
|
|
637863
637954
|
}
|
|
637864
637955
|
deleteTokenBefore() {
|
|
637865
|
-
const chipAfter = this.
|
|
637956
|
+
const chipAfter = this.placeholderStartingAt(this.offset);
|
|
637866
637957
|
if (chipAfter) {
|
|
637867
637958
|
const end = this.text[chipAfter.end] === " " ? chipAfter.end + 1 : chipAfter.end;
|
|
637868
637959
|
return this.modifyText(new Cursor(this.measuredText, end));
|
|
@@ -637875,7 +637966,7 @@ class Cursor {
|
|
|
637875
637966
|
return null;
|
|
637876
637967
|
}
|
|
637877
637968
|
const textBefore = this.text.slice(0, this.offset);
|
|
637878
|
-
const pasteMatch = textBefore.match(/(^|\s)\[(Pasted text #\d+(?: \+\d+ lines)?|Image #\d+|\.\.\.Truncated text #\d+ \+\d+ lines\.\.\.)\]$/);
|
|
637969
|
+
const pasteMatch = textBefore.match(/(^|\s)\[(Pasted text #\d+(?: \+\d+ lines)?|Image #\d+|Audio #\d+|\.\.\.Truncated text #\d+ \+\d+ lines\.\.\.)\]$/);
|
|
637879
637970
|
if (pasteMatch) {
|
|
637880
637971
|
const matchStart = pasteMatch.index + pasteMatch[1].length;
|
|
637881
637972
|
return new Cursor(this.measuredText, matchStart).modifyText(this);
|
|
@@ -637886,8 +637977,7 @@ class Cursor {
|
|
|
637886
637977
|
if (this.isAtEnd()) {
|
|
637887
637978
|
return this;
|
|
637888
637979
|
}
|
|
637889
|
-
|
|
637890
|
-
return this.modifyText(new Cursor(this.measuredText, target));
|
|
637980
|
+
return this.killRange(this.offset, this.nextWord().offset).cursor;
|
|
637891
637981
|
}
|
|
637892
637982
|
graphemeAt(pos) {
|
|
637893
637983
|
if (pos >= this.text.length)
|
|
@@ -638042,6 +638132,31 @@ class MeasuredText {
|
|
|
638042
638132
|
}
|
|
638043
638133
|
return this.wordBoundariesCache;
|
|
638044
638134
|
}
|
|
638135
|
+
readlineWordBoundariesCache;
|
|
638136
|
+
getReadlineWordBoundaries() {
|
|
638137
|
+
if (!this.readlineWordBoundariesCache) {
|
|
638138
|
+
const boundaries = [];
|
|
638139
|
+
let snappedPrev = false;
|
|
638140
|
+
for (const word of this.getWordBoundaries()) {
|
|
638141
|
+
const wordText = this.text.slice(word.start, word.end);
|
|
638142
|
+
for (const match of wordText.matchAll(READLINE_WORD_RE)) {
|
|
638143
|
+
const start = this.snapToGraphemeBoundary(word.start + match.index);
|
|
638144
|
+
const rawEnd = word.start + match.index + match[0].length;
|
|
638145
|
+
const snappedEnd = this.snapToGraphemeBoundary(rawEnd);
|
|
638146
|
+
const end = snappedEnd === rawEnd ? rawEnd : this.nextOffset(snappedEnd);
|
|
638147
|
+
const last3 = boundaries.at(-1);
|
|
638148
|
+
if (last3 && (start < last3.end || start === last3.end && snappedPrev)) {
|
|
638149
|
+
last3.end = Math.max(last3.end, end);
|
|
638150
|
+
} else {
|
|
638151
|
+
boundaries.push({ start, end });
|
|
638152
|
+
}
|
|
638153
|
+
snappedPrev = end !== rawEnd;
|
|
638154
|
+
}
|
|
638155
|
+
}
|
|
638156
|
+
this.readlineWordBoundariesCache = boundaries;
|
|
638157
|
+
}
|
|
638158
|
+
return this.readlineWordBoundariesCache;
|
|
638159
|
+
}
|
|
638045
638160
|
binarySearchBoundary(boundaries, target, findNext) {
|
|
638046
638161
|
let left2 = 0;
|
|
638047
638162
|
let right2 = boundaries.length - 1;
|
|
@@ -638264,16 +638379,33 @@ class MeasuredText {
|
|
|
638264
638379
|
return boundaries[lo];
|
|
638265
638380
|
}
|
|
638266
638381
|
}
|
|
638267
|
-
var KILL_RING_MAX_SIZE = 10, killRing, killRingIndex = 0, lastActionWasKill = false, lastYankStart = 0, lastYankLength = 0, lastActionWasYank = false, VIM_WORD_CHAR_REGEX, WHITESPACE_REGEX2, isVimWordChar = (ch2) => VIM_WORD_CHAR_REGEX.test(ch2), isVimWhitespace = (ch2) => WHITESPACE_REGEX2.test(ch2), isVimPunctuation = (ch2) => ch2.length > 0 && !isVimWhitespace(ch2) && !isVimWordChar(ch2);
|
|
638382
|
+
var PLACEHOLDER_PATTERN, PLACEHOLDER_ENDING_RE, PLACEHOLDER_STARTING_RE, PLACEHOLDER_GLOBAL_RE, READLINE_WORD_RE, KILL_RING_MAX_SIZE = 10, killRing, killRingIndex = 0, lastActionWasKill = false, lastYankStart = 0, lastYankLength = 0, lastActionWasYank = false, VIM_WORD_CHAR_REGEX, WHITESPACE_REGEX2, isVimWordChar = (ch2) => VIM_WORD_CHAR_REGEX.test(ch2), isVimWhitespace = (ch2) => WHITESPACE_REGEX2.test(ch2), isVimPunctuation = (ch2) => ch2.length > 0 && !isVimWhitespace(ch2) && !isVimWordChar(ch2);
|
|
638268
638383
|
var init_Cursor = __esm(() => {
|
|
638269
638384
|
init_stringWidth();
|
|
638270
638385
|
init_wrapAnsi();
|
|
638271
638386
|
init_intl();
|
|
638387
|
+
PLACEHOLDER_PATTERN = String.raw`\[(?:Pasted text|Image|Audio|\.\.\.Truncated text) #\d+(?: \+\d+ lines)?\.*\]`;
|
|
638388
|
+
PLACEHOLDER_ENDING_RE = new RegExp(PLACEHOLDER_PATTERN + "$");
|
|
638389
|
+
PLACEHOLDER_STARTING_RE = new RegExp("^" + PLACEHOLDER_PATTERN);
|
|
638390
|
+
PLACEHOLDER_GLOBAL_RE = new RegExp(PLACEHOLDER_PATTERN, "g");
|
|
638391
|
+
READLINE_WORD_RE = /[\p{L}\p{N}][\p{L}\p{N}\p{M}]*/gu;
|
|
638272
638392
|
killRing = [];
|
|
638273
638393
|
VIM_WORD_CHAR_REGEX = /^[\p{L}\p{N}\p{M}_]$/u;
|
|
638274
638394
|
WHITESPACE_REGEX2 = /\s/;
|
|
638275
638395
|
});
|
|
638276
638396
|
|
|
638397
|
+
// src/utils/keybindingFlavor.ts
|
|
638398
|
+
function getKeybindingFlavor() {
|
|
638399
|
+
return getInitialSettings().keybindingFlavor === "readline" ? "readline" : DEFAULT_KEYBINDING_FLAVOR;
|
|
638400
|
+
}
|
|
638401
|
+
function isReadlineKeybindingFlavor() {
|
|
638402
|
+
return getKeybindingFlavor() === "readline";
|
|
638403
|
+
}
|
|
638404
|
+
var DEFAULT_KEYBINDING_FLAVOR = "classic";
|
|
638405
|
+
var init_keybindingFlavor = __esm(() => {
|
|
638406
|
+
init_settings2();
|
|
638407
|
+
});
|
|
638408
|
+
|
|
638277
638409
|
// packages/modifiers-napi/src/index.ts
|
|
638278
638410
|
var exports_src6 = {};
|
|
638279
638411
|
__export(exports_src6, {
|
|
@@ -638386,6 +638518,7 @@ function useTextInput({
|
|
|
638386
638518
|
const setOffset = onOffsetChange;
|
|
638387
638519
|
const cursor = Cursor.fromText(originalValue, columns, offset);
|
|
638388
638520
|
const { addNotification, removeNotification } = useNotifications();
|
|
638521
|
+
const isReadline = isReadlineKeybindingFlavor();
|
|
638389
638522
|
const handleCtrlC = useDoublePress((show) => {
|
|
638390
638523
|
onExitMessage?.(show, "Ctrl-C");
|
|
638391
638524
|
}, () => onExit2?.(), () => {
|
|
@@ -638409,7 +638542,7 @@ function useTextInput({
|
|
|
638409
638542
|
removeNotification("escape-again-to-clear");
|
|
638410
638543
|
onClearInput?.();
|
|
638411
638544
|
if (originalValue) {
|
|
638412
|
-
if (originalValue.trim() !== "") {
|
|
638545
|
+
if (mask === "" && originalValue.trim() !== "") {
|
|
638413
638546
|
addToHistory(originalValue);
|
|
638414
638547
|
}
|
|
638415
638548
|
onChange("");
|
|
@@ -638435,16 +638568,23 @@ function useTextInput({
|
|
|
638435
638568
|
}
|
|
638436
638569
|
return cursor.del();
|
|
638437
638570
|
}
|
|
638571
|
+
function recordKill(killed, direction) {
|
|
638572
|
+
if (mask === "") {
|
|
638573
|
+
pushToKillRing(killed, direction);
|
|
638574
|
+
} else {
|
|
638575
|
+
resetKillAccumulation();
|
|
638576
|
+
}
|
|
638577
|
+
announceDeletedText(killed, mask);
|
|
638578
|
+
}
|
|
638438
638579
|
function killToLineEnd() {
|
|
638439
638580
|
const { cursor: newCursor, killed } = cursor.deleteToLineEnd();
|
|
638440
|
-
|
|
638441
|
-
announceDeletedText(killed);
|
|
638581
|
+
recordKill(killed, "append");
|
|
638442
638582
|
return newCursor;
|
|
638443
638583
|
}
|
|
638444
638584
|
function killToLineStart() {
|
|
638445
638585
|
const { cursor: newCursor, killed } = cursor.deleteToLineStart();
|
|
638446
|
-
|
|
638447
|
-
if (killed.length >= 3) {
|
|
638586
|
+
recordKill(killed, "prepend");
|
|
638587
|
+
if (mask === "" && killed.length >= 3) {
|
|
638448
638588
|
addNotification({
|
|
638449
638589
|
key: "kill-paste-hint",
|
|
638450
638590
|
text: "Ctrl+Y to paste deleted text",
|
|
@@ -638452,13 +638592,26 @@ function useTextInput({
|
|
|
638452
638592
|
timeoutMs: 5000
|
|
638453
638593
|
});
|
|
638454
638594
|
}
|
|
638455
|
-
announceDeletedText(killed);
|
|
638456
638595
|
return newCursor;
|
|
638457
638596
|
}
|
|
638458
638597
|
function killWordBefore() {
|
|
638459
638598
|
const { cursor: newCursor, killed } = cursor.deleteWordBefore();
|
|
638460
|
-
|
|
638461
|
-
|
|
638599
|
+
recordKill(killed, "prepend");
|
|
638600
|
+
return newCursor;
|
|
638601
|
+
}
|
|
638602
|
+
function killWORDBefore() {
|
|
638603
|
+
const { cursor: newCursor, killed } = cursor.deleteWORDBefore();
|
|
638604
|
+
recordKill(killed, "prepend");
|
|
638605
|
+
return newCursor;
|
|
638606
|
+
}
|
|
638607
|
+
function killWordBeforeFlavored() {
|
|
638608
|
+
const { cursor: newCursor, killed } = isReadline ? cursor.backwardKillWord() : cursor.deleteWordBefore();
|
|
638609
|
+
recordKill(killed, "prepend");
|
|
638610
|
+
return newCursor;
|
|
638611
|
+
}
|
|
638612
|
+
function killWordAfter() {
|
|
638613
|
+
const { cursor: newCursor, killed } = cursor.killWord();
|
|
638614
|
+
recordKill(killed, "append");
|
|
638462
638615
|
return newCursor;
|
|
638463
638616
|
}
|
|
638464
638617
|
function yank() {
|
|
@@ -638496,13 +638649,13 @@ function useTextInput({
|
|
|
638496
638649
|
["n", () => downOrHistoryDown()],
|
|
638497
638650
|
["p", () => upOrHistoryUp()],
|
|
638498
638651
|
["u", fullscreen ? NOOP_HANDLER : killToLineStart],
|
|
638499
|
-
["w", killWordBefore],
|
|
638652
|
+
["w", isReadline ? killWORDBefore : killWordBefore],
|
|
638500
638653
|
["y", yank]
|
|
638501
638654
|
]);
|
|
638502
638655
|
const handleMeta = mapInput([
|
|
638503
|
-
["b", () => cursor.prevWord()],
|
|
638504
|
-
["f", () => cursor.nextWord()],
|
|
638505
|
-
["d", () => cursor.deleteWordAfter()],
|
|
638656
|
+
["b", () => isReadline ? cursor.backwardWord() : cursor.prevWord()],
|
|
638657
|
+
["f", () => isReadline ? cursor.forwardWord() : cursor.nextWord()],
|
|
638658
|
+
["d", isReadline ? killWordAfter : () => cursor.deleteWordAfter()],
|
|
638506
638659
|
["y", handleYankPop]
|
|
638507
638660
|
]);
|
|
638508
638661
|
function handleEnter(key4) {
|
|
@@ -638567,13 +638720,13 @@ function useTextInput({
|
|
|
638567
638720
|
return cursor;
|
|
638568
638721
|
};
|
|
638569
638722
|
case (key4.leftArrow && (key4.ctrl || key4.meta || key4.fn)):
|
|
638570
|
-
return () => cursor.prevWord();
|
|
638723
|
+
return () => isReadline ? cursor.backwardWord() : cursor.prevWord();
|
|
638571
638724
|
case (key4.rightArrow && (key4.ctrl || key4.meta || key4.fn)):
|
|
638572
|
-
return () => cursor.nextWord();
|
|
638725
|
+
return () => isReadline ? cursor.forwardWord() : cursor.nextWord();
|
|
638573
638726
|
case key4.backspace:
|
|
638574
|
-
return key4.meta || key4.ctrl ?
|
|
638727
|
+
return key4.super ? killToLineStart : key4.meta || key4.ctrl ? killWordBeforeFlavored : () => cursor.deleteTokenBefore() ?? cursor.backspace();
|
|
638575
638728
|
case key4.delete:
|
|
638576
|
-
return key4.meta ? killToLineEnd : () => cursor.del();
|
|
638729
|
+
return key4.super || key4.meta ? killToLineEnd : () => cursor.del();
|
|
638577
638730
|
case key4.ctrl:
|
|
638578
638731
|
return handleCtrl;
|
|
638579
638732
|
case key4.home:
|
|
@@ -638636,7 +638789,13 @@ function useTextInput({
|
|
|
638636
638789
|
if (key4.ctrl && (input2 === "k" || input2 === "u" || input2 === "w")) {
|
|
638637
638790
|
return true;
|
|
638638
638791
|
}
|
|
638639
|
-
if (key4.meta &&
|
|
638792
|
+
if (isReadline && key4.meta && !key4.ctrl && input2 === "d") {
|
|
638793
|
+
return true;
|
|
638794
|
+
}
|
|
638795
|
+
if (key4.backspace && (key4.meta || key4.super || key4.ctrl)) {
|
|
638796
|
+
return true;
|
|
638797
|
+
}
|
|
638798
|
+
if (key4.delete && (key4.meta || key4.super)) {
|
|
638640
638799
|
return true;
|
|
638641
638800
|
}
|
|
638642
638801
|
return false;
|
|
@@ -638706,6 +638865,7 @@ var init_useTextInput = __esm(() => {
|
|
|
638706
638865
|
init_Cursor();
|
|
638707
638866
|
init_env();
|
|
638708
638867
|
init_fullscreen();
|
|
638868
|
+
init_keybindingFlavor();
|
|
638709
638869
|
init_useDoublePress();
|
|
638710
638870
|
init_srA11y();
|
|
638711
638871
|
init_screenReader();
|
|
@@ -649192,11 +649352,14 @@ var init_SearchBox = __esm(() => {
|
|
|
649192
649352
|
});
|
|
649193
649353
|
|
|
649194
649354
|
// src/hooks/useSearchInput.ts
|
|
649195
|
-
function isKillKey(e4) {
|
|
649355
|
+
function isKillKey(e4, isReadline) {
|
|
649196
649356
|
if (e4.ctrl && (e4.key === "k" || e4.key === "u" || e4.key === "w")) {
|
|
649197
649357
|
return true;
|
|
649198
649358
|
}
|
|
649199
|
-
if (e4.meta && e4.key === "backspace") {
|
|
649359
|
+
if ((e4.meta || e4.ctrl) && e4.key === "backspace") {
|
|
649360
|
+
return true;
|
|
649361
|
+
}
|
|
649362
|
+
if (isReadline && e4.meta && !e4.ctrl && e4.key.toLowerCase() === "d") {
|
|
649200
649363
|
return true;
|
|
649201
649364
|
}
|
|
649202
649365
|
return false;
|
|
@@ -649218,6 +649381,7 @@ function useSearchInput({
|
|
|
649218
649381
|
const effectiveColumns = columns ?? terminalColumns;
|
|
649219
649382
|
const [query2, setQueryState] = import_react107.useState(initialQuery);
|
|
649220
649383
|
const [cursorOffset, setCursorOffset] = import_react107.useState(initialQuery.length);
|
|
649384
|
+
const isReadline = isReadlineKeybindingFlavor();
|
|
649221
649385
|
const setQuery = import_react107.useCallback((q6) => {
|
|
649222
649386
|
setQueryState(q6);
|
|
649223
649387
|
setCursorOffset(q6.length);
|
|
@@ -649226,15 +649390,15 @@ function useSearchInput({
|
|
|
649226
649390
|
if (!isActive)
|
|
649227
649391
|
return;
|
|
649228
649392
|
const cursor = Cursor.fromText(query2, effectiveColumns, cursorOffset);
|
|
649229
|
-
if (e4
|
|
649230
|
-
return;
|
|
649231
|
-
}
|
|
649232
|
-
if (!isKillKey(e4)) {
|
|
649393
|
+
if (!isKillKey(e4, isReadline)) {
|
|
649233
649394
|
resetKillAccumulation();
|
|
649234
649395
|
}
|
|
649235
649396
|
if (!isYankKey(e4)) {
|
|
649236
649397
|
resetYankState();
|
|
649237
649398
|
}
|
|
649399
|
+
if (e4.ctrl && passthroughCtrlKeys.includes(e4.key.toLowerCase())) {
|
|
649400
|
+
return;
|
|
649401
|
+
}
|
|
649238
649402
|
if (e4.key === "return" || e4.key === "down") {
|
|
649239
649403
|
e4.preventDefault();
|
|
649240
649404
|
onExit2();
|
|
@@ -649261,8 +649425,8 @@ function useSearchInput({
|
|
|
649261
649425
|
}
|
|
649262
649426
|
if (e4.key === "backspace") {
|
|
649263
649427
|
e4.preventDefault();
|
|
649264
|
-
if (e4.meta) {
|
|
649265
|
-
const { cursor: newCursor2, killed } = cursor.deleteWordBefore();
|
|
649428
|
+
if (e4.meta || e4.ctrl) {
|
|
649429
|
+
const { cursor: newCursor2, killed } = isReadline ? cursor.backwardKillWord() : cursor.deleteWordBefore();
|
|
649266
649430
|
pushToKillRing(killed, "prepend");
|
|
649267
649431
|
setQueryState(newCursor2.text);
|
|
649268
649432
|
setCursorOffset(newCursor2.offset);
|
|
@@ -649287,13 +649451,13 @@ function useSearchInput({
|
|
|
649287
649451
|
}
|
|
649288
649452
|
if (e4.key === "left" && (e4.ctrl || e4.meta || e4.fn)) {
|
|
649289
649453
|
e4.preventDefault();
|
|
649290
|
-
const newCursor = cursor.prevWord();
|
|
649454
|
+
const newCursor = isReadline ? cursor.backwardWord() : cursor.prevWord();
|
|
649291
649455
|
setCursorOffset(newCursor.offset);
|
|
649292
649456
|
return;
|
|
649293
649457
|
}
|
|
649294
649458
|
if (e4.key === "right" && (e4.ctrl || e4.meta || e4.fn)) {
|
|
649295
649459
|
e4.preventDefault();
|
|
649296
|
-
const newCursor = cursor.nextWord();
|
|
649460
|
+
const newCursor = isReadline ? cursor.forwardWord() : cursor.nextWord();
|
|
649297
649461
|
setCursorOffset(newCursor.offset);
|
|
649298
649462
|
return;
|
|
649299
649463
|
}
|
|
@@ -649370,7 +649534,7 @@ function useSearchInput({
|
|
|
649370
649534
|
return;
|
|
649371
649535
|
}
|
|
649372
649536
|
case "w": {
|
|
649373
|
-
const { cursor: newCursor, killed } = cursor.deleteWordBefore();
|
|
649537
|
+
const { cursor: newCursor, killed } = isReadline ? cursor.deleteWORDBefore() : cursor.deleteWordBefore();
|
|
649374
649538
|
pushToKillRing(killed, "prepend");
|
|
649375
649539
|
setQueryState(newCursor.text);
|
|
649376
649540
|
setCursorOffset(newCursor.offset);
|
|
@@ -649400,12 +649564,19 @@ function useSearchInput({
|
|
|
649400
649564
|
e4.preventDefault();
|
|
649401
649565
|
switch (e4.key.toLowerCase()) {
|
|
649402
649566
|
case "b":
|
|
649403
|
-
setCursorOffset(cursor.prevWord().offset);
|
|
649567
|
+
setCursorOffset((isReadline ? cursor.backwardWord() : cursor.prevWord()).offset);
|
|
649404
649568
|
return;
|
|
649405
649569
|
case "f":
|
|
649406
|
-
setCursorOffset(cursor.nextWord().offset);
|
|
649570
|
+
setCursorOffset((isReadline ? cursor.forwardWord() : cursor.nextWord()).offset);
|
|
649407
649571
|
return;
|
|
649408
649572
|
case "d": {
|
|
649573
|
+
if (isReadline) {
|
|
649574
|
+
const { cursor: newCursor2, killed } = cursor.killWord();
|
|
649575
|
+
pushToKillRing(killed, "append");
|
|
649576
|
+
setQueryState(newCursor2.text);
|
|
649577
|
+
setCursorOffset(newCursor2.offset);
|
|
649578
|
+
return;
|
|
649579
|
+
}
|
|
649409
649580
|
const newCursor = cursor.deleteWordAfter();
|
|
649410
649581
|
setQueryState(newCursor.text);
|
|
649411
649582
|
setCursorOffset(newCursor.offset);
|
|
@@ -649448,6 +649619,7 @@ var init_useSearchInput = __esm(() => {
|
|
|
649448
649619
|
init_keyboard_event();
|
|
649449
649620
|
init_ink2();
|
|
649450
649621
|
init_Cursor();
|
|
649622
|
+
init_keybindingFlavor();
|
|
649451
649623
|
init_useTerminalSize();
|
|
649452
649624
|
import_react107 = __toESM(require_react(), 1);
|
|
649453
649625
|
UNHANDLED_SPECIAL_KEYS = new Set([
|
|
@@ -769719,8 +769891,8 @@ function getOperatorRange(cursor, target, motion, op, count4) {
|
|
|
769719
769891
|
} else if (isInclusiveMotion(motion) && cursor.offset <= target.offset) {
|
|
769720
769892
|
to = cursor.measuredText.nextOffset(to);
|
|
769721
769893
|
}
|
|
769722
|
-
from2 = cursor.
|
|
769723
|
-
to = cursor.
|
|
769894
|
+
from2 = cursor.snapOutOfPlaceholder(from2, "start");
|
|
769895
|
+
to = cursor.snapOutOfPlaceholder(to, "end");
|
|
769724
769896
|
return { from: from2, to, linewise };
|
|
769725
769897
|
}
|
|
769726
769898
|
function getOperatorRangeForFind(cursor, target, _findType) {
|