@cnwenf/occ 2.1.308 → 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.
Files changed (2) hide show
  1. package/dist/cli.js +212 -72
  2. 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.308","BINARY_NAME":"occ","BUILD_TIME":"2026-08-21T18:25:57.305Z","FEEDBACK_CHANNEL":"","ISSUES_EXPLAINER":"","NATIVE_PACKAGE_URL":"","PACKAGE_URL":"@cnwenf/occ","VERSION_CHANGELOG":""};
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;
@@ -452681,10 +452681,17 @@ var init_ink3 = __esm(() => {
452681
452681
  });
452682
452682
 
452683
452683
  // src/utils/srA11y.ts
452684
- function announceDeletedText(deletedText, sink2 = pushScreenReaderAnnouncement) {
452685
- if (deletedText.length > 0) {
452686
- sink2(deletedText);
452684
+ function announceDeletedText(deletedText, mask = "", sink2 = pushScreenReaderAnnouncement) {
452685
+ if (deletedText === "")
452686
+ return;
452687
+ if (mask !== "") {
452688
+ sink2("deleted");
452689
+ return;
452687
452690
  }
452691
+ const announcement = deletedText.trim() === "" ? deletedText.includes(`
452692
+ `) ? "new line" : deletedText.includes("\t") ? "tab" : "space" : deletedText.replaceAll(`
452693
+ `, " ").trim();
452694
+ sink2(announcement);
452688
452695
  }
452689
452696
  function srEchoTypedChar(char) {
452690
452697
  if (char === " ") {
@@ -637446,7 +637453,7 @@ class Cursor {
637446
637453
  left() {
637447
637454
  if (this.offset === 0)
637448
637455
  return this;
637449
- const chip = this.imageRefEndingAt(this.offset);
637456
+ const chip = this.placeholderEndingAt(this.offset);
637450
637457
  if (chip)
637451
637458
  return new Cursor(this.measuredText, chip.start);
637452
637459
  const prevOffset = this.measuredText.prevOffset(this.offset);
@@ -637455,31 +637462,40 @@ class Cursor {
637455
637462
  right() {
637456
637463
  if (this.offset >= this.text.length)
637457
637464
  return this;
637458
- const chip = this.imageRefStartingAt(this.offset);
637465
+ const chip = this.placeholderStartingAt(this.offset);
637459
637466
  if (chip)
637460
637467
  return new Cursor(this.measuredText, chip.end);
637461
637468
  const nextOffset = this.measuredText.nextOffset(this.offset);
637462
637469
  return new Cursor(this.measuredText, Math.min(nextOffset, this.text.length));
637463
637470
  }
637464
- imageRefEndingAt(offset) {
637465
- const m5 = this.text.slice(0, offset).match(/\[Image #\d+\]$/);
637471
+ placeholderEndingAt(offset) {
637472
+ if (this.text[offset - 1] !== "]")
637473
+ return null;
637474
+ const m5 = this.text.slice(0, offset).match(PLACEHOLDER_ENDING_RE);
637466
637475
  return m5 ? { start: offset - m5[0].length, end: offset } : null;
637467
637476
  }
637468
- imageRefStartingAt(offset) {
637469
- const m5 = this.text.slice(offset).match(/^\[Image #\d+\]/);
637477
+ placeholderStartingAt(offset) {
637478
+ if (this.text[offset] !== "[")
637479
+ return null;
637480
+ const m5 = this.text.slice(offset).match(PLACEHOLDER_STARTING_RE);
637470
637481
  return m5 ? { start: offset, end: offset + m5[0].length } : null;
637471
637482
  }
637472
- snapOutOfImageRef(offset, toward) {
637473
- const re3 = /\[Image #\d+\]/g;
637474
- let m5;
637475
- while ((m5 = re3.exec(this.text)) !== null) {
637476
- const start = m5.index;
637483
+ placeholderContaining(offset) {
637484
+ for (const m5 of this.text.matchAll(PLACEHOLDER_GLOBAL_RE)) {
637485
+ const start = m5.index ?? 0;
637477
637486
  const end = start + m5[0].length;
637478
- if (offset > start && offset < end) {
637479
- return toward === "start" ? start : end;
637480
- }
637487
+ if (offset > start && offset < end)
637488
+ return { start, end };
637489
+ if (start >= offset)
637490
+ break;
637481
637491
  }
637482
- return offset;
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;
637483
637499
  }
637484
637500
  up() {
637485
637501
  const { line, column } = this.getPosition();
@@ -637615,10 +637631,15 @@ class Cursor {
637615
637631
  if (this.isAtEnd()) {
637616
637632
  return this;
637617
637633
  }
637634
+ const chip = this.placeholderStartingAt(this.offset) ?? this.placeholderContaining(this.offset);
637635
+ if (chip) {
637636
+ return new Cursor(this.measuredText, chip.end);
637637
+ }
637618
637638
  const wordBoundaries = this.measuredText.getWordBoundaries();
637619
637639
  for (const boundary of wordBoundaries) {
637620
637640
  if (boundary.isWordLike && boundary.start > this.offset) {
637621
- return new Cursor(this.measuredText, boundary.start);
637641
+ const target = this.snapOutOfPlaceholder(boundary.start, "end");
637642
+ return new Cursor(this.measuredText, target);
637622
637643
  }
637623
637644
  }
637624
637645
  return new Cursor(this.measuredText, this.text.length);
@@ -637654,6 +637675,14 @@ class Cursor {
637654
637675
  if (this.isAtStart()) {
637655
637676
  return this;
637656
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
+ }
637657
637686
  const wordBoundaries = this.measuredText.getWordBoundaries();
637658
637687
  let prevWordStart = null;
637659
637688
  for (const boundary of wordBoundaries) {
@@ -637661,13 +637690,15 @@ class Cursor {
637661
637690
  continue;
637662
637691
  if (boundary.start < this.offset) {
637663
637692
  if (this.offset > boundary.start && this.offset <= boundary.end) {
637664
- return new Cursor(this.measuredText, boundary.start);
637693
+ const target = this.snapOutOfPlaceholder(boundary.start, "start");
637694
+ return new Cursor(this.measuredText, target);
637665
637695
  }
637666
637696
  prevWordStart = boundary.start;
637667
637697
  }
637668
637698
  }
637669
637699
  if (prevWordStart !== null) {
637670
- return new Cursor(this.measuredText, prevWordStart);
637700
+ const target = this.snapOutOfPlaceholder(prevWordStart, "start");
637701
+ return new Cursor(this.measuredText, target);
637671
637702
  }
637672
637703
  return new Cursor(this.measuredText, 0);
637673
637704
  }
@@ -637804,6 +637835,64 @@ class Cursor {
637804
637835
  }
637805
637836
  return cursor;
637806
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
+ }
637807
637896
  modifyText(end, insertString = "") {
637808
637897
  const startOffset = this.offset;
637809
637898
  const endOffset = end.offset;
@@ -637833,8 +637922,7 @@ class Cursor {
637833
637922
  ` };
637834
637923
  }
637835
637924
  const startCursor = this.startOfLine();
637836
- const killed = this.text.slice(startCursor.offset, this.offset);
637837
- return { cursor: startCursor.modifyText(this), killed };
637925
+ return this.killRange(startCursor.offset, this.offset);
637838
637926
  }
637839
637927
  deleteToLineEnd() {
637840
637928
  if (this.text[this.offset] === `
@@ -637843,36 +637931,29 @@ class Cursor {
637843
637931
  ` };
637844
637932
  }
637845
637933
  const endCursor = this.endOfLine();
637846
- const killed = this.text.slice(this.offset, endCursor.offset);
637847
- return { cursor: this.modifyText(endCursor), killed };
637934
+ return this.killRange(this.offset, endCursor.offset);
637848
637935
  }
637849
637936
  deleteToLogicalLineEnd() {
637850
637937
  if (this.text[this.offset] === `
637851
637938
  `) {
637852
637939
  return this.modifyText(this.right());
637853
637940
  }
637854
- return this.modifyText(this.endOfLogicalLine());
637941
+ return this.killRange(this.offset, this.endOfLogicalLine().offset).cursor;
637855
637942
  }
637856
637943
  deleteWordBefore() {
637857
637944
  if (this.isAtStart()) {
637858
637945
  return { cursor: this, killed: "" };
637859
637946
  }
637860
- const target = this.snapOutOfImageRef(this.prevWord().offset, "start");
637861
- const prevWordCursor = new Cursor(this.measuredText, target);
637862
- const killed = this.text.slice(prevWordCursor.offset, this.offset);
637863
- return { cursor: prevWordCursor.modifyText(this), killed };
637947
+ return this.killRange(this.prevWord().offset, this.offset);
637864
637948
  }
637865
637949
  deleteWORDBefore() {
637866
637950
  if (this.isAtStart()) {
637867
637951
  return { cursor: this, killed: "" };
637868
637952
  }
637869
- const target = this.snapOutOfImageRef(this.prevWORD().offset, "start");
637870
- const prevWORDCursor = new Cursor(this.measuredText, target);
637871
- const killed = this.text.slice(prevWORDCursor.offset, this.offset);
637872
- return { cursor: prevWORDCursor.modifyText(this), killed };
637953
+ return this.killRange(this.prevWORD().offset, this.offset);
637873
637954
  }
637874
637955
  deleteTokenBefore() {
637875
- const chipAfter = this.imageRefStartingAt(this.offset);
637956
+ const chipAfter = this.placeholderStartingAt(this.offset);
637876
637957
  if (chipAfter) {
637877
637958
  const end = this.text[chipAfter.end] === " " ? chipAfter.end + 1 : chipAfter.end;
637878
637959
  return this.modifyText(new Cursor(this.measuredText, end));
@@ -637885,7 +637966,7 @@ class Cursor {
637885
637966
  return null;
637886
637967
  }
637887
637968
  const textBefore = this.text.slice(0, this.offset);
637888
- 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\.\.\.)\]$/);
637889
637970
  if (pasteMatch) {
637890
637971
  const matchStart = pasteMatch.index + pasteMatch[1].length;
637891
637972
  return new Cursor(this.measuredText, matchStart).modifyText(this);
@@ -637896,8 +637977,7 @@ class Cursor {
637896
637977
  if (this.isAtEnd()) {
637897
637978
  return this;
637898
637979
  }
637899
- const target = this.snapOutOfImageRef(this.nextWord().offset, "end");
637900
- return this.modifyText(new Cursor(this.measuredText, target));
637980
+ return this.killRange(this.offset, this.nextWord().offset).cursor;
637901
637981
  }
637902
637982
  graphemeAt(pos) {
637903
637983
  if (pos >= this.text.length)
@@ -638052,6 +638132,31 @@ class MeasuredText {
638052
638132
  }
638053
638133
  return this.wordBoundariesCache;
638054
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
+ }
638055
638160
  binarySearchBoundary(boundaries, target, findNext) {
638056
638161
  let left2 = 0;
638057
638162
  let right2 = boundaries.length - 1;
@@ -638274,11 +638379,16 @@ class MeasuredText {
638274
638379
  return boundaries[lo];
638275
638380
  }
638276
638381
  }
638277
- 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);
638278
638383
  var init_Cursor = __esm(() => {
638279
638384
  init_stringWidth();
638280
638385
  init_wrapAnsi();
638281
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;
638282
638392
  killRing = [];
638283
638393
  VIM_WORD_CHAR_REGEX = /^[\p{L}\p{N}\p{M}_]$/u;
638284
638394
  WHITESPACE_REGEX2 = /\s/;
@@ -638432,7 +638542,7 @@ function useTextInput({
638432
638542
  removeNotification("escape-again-to-clear");
638433
638543
  onClearInput?.();
638434
638544
  if (originalValue) {
638435
- if (originalValue.trim() !== "") {
638545
+ if (mask === "" && originalValue.trim() !== "") {
638436
638546
  addToHistory(originalValue);
638437
638547
  }
638438
638548
  onChange("");
@@ -638458,16 +638568,23 @@ function useTextInput({
638458
638568
  }
638459
638569
  return cursor.del();
638460
638570
  }
638571
+ function recordKill(killed, direction) {
638572
+ if (mask === "") {
638573
+ pushToKillRing(killed, direction);
638574
+ } else {
638575
+ resetKillAccumulation();
638576
+ }
638577
+ announceDeletedText(killed, mask);
638578
+ }
638461
638579
  function killToLineEnd() {
638462
638580
  const { cursor: newCursor, killed } = cursor.deleteToLineEnd();
638463
- pushToKillRing(killed, "append");
638464
- announceDeletedText(killed);
638581
+ recordKill(killed, "append");
638465
638582
  return newCursor;
638466
638583
  }
638467
638584
  function killToLineStart() {
638468
638585
  const { cursor: newCursor, killed } = cursor.deleteToLineStart();
638469
- pushToKillRing(killed, "prepend");
638470
- if (killed.length >= 3) {
638586
+ recordKill(killed, "prepend");
638587
+ if (mask === "" && killed.length >= 3) {
638471
638588
  addNotification({
638472
638589
  key: "kill-paste-hint",
638473
638590
  text: "Ctrl+Y to paste deleted text",
@@ -638475,19 +638592,26 @@ function useTextInput({
638475
638592
  timeoutMs: 5000
638476
638593
  });
638477
638594
  }
638478
- announceDeletedText(killed);
638479
638595
  return newCursor;
638480
638596
  }
638481
638597
  function killWordBefore() {
638482
638598
  const { cursor: newCursor, killed } = cursor.deleteWordBefore();
638483
- pushToKillRing(killed, "prepend");
638484
- announceDeletedText(killed);
638599
+ recordKill(killed, "prepend");
638485
638600
  return newCursor;
638486
638601
  }
638487
638602
  function killWORDBefore() {
638488
638603
  const { cursor: newCursor, killed } = cursor.deleteWORDBefore();
638489
- pushToKillRing(killed, "prepend");
638490
- announceDeletedText(killed);
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");
638491
638615
  return newCursor;
638492
638616
  }
638493
638617
  function yank() {
@@ -638529,9 +638653,9 @@ function useTextInput({
638529
638653
  ["y", yank]
638530
638654
  ]);
638531
638655
  const handleMeta = mapInput([
638532
- ["b", () => cursor.prevWord()],
638533
- ["f", () => cursor.nextWord()],
638534
- ["d", () => cursor.deleteWordAfter()],
638656
+ ["b", () => isReadline ? cursor.backwardWord() : cursor.prevWord()],
638657
+ ["f", () => isReadline ? cursor.forwardWord() : cursor.nextWord()],
638658
+ ["d", isReadline ? killWordAfter : () => cursor.deleteWordAfter()],
638535
638659
  ["y", handleYankPop]
638536
638660
  ]);
638537
638661
  function handleEnter(key4) {
@@ -638596,13 +638720,13 @@ function useTextInput({
638596
638720
  return cursor;
638597
638721
  };
638598
638722
  case (key4.leftArrow && (key4.ctrl || key4.meta || key4.fn)):
638599
- return () => cursor.prevWord();
638723
+ return () => isReadline ? cursor.backwardWord() : cursor.prevWord();
638600
638724
  case (key4.rightArrow && (key4.ctrl || key4.meta || key4.fn)):
638601
- return () => cursor.nextWord();
638725
+ return () => isReadline ? cursor.forwardWord() : cursor.nextWord();
638602
638726
  case key4.backspace:
638603
- return key4.meta || key4.ctrl ? killWordBefore : () => cursor.deleteTokenBefore() ?? cursor.backspace();
638727
+ return key4.super ? killToLineStart : key4.meta || key4.ctrl ? killWordBeforeFlavored : () => cursor.deleteTokenBefore() ?? cursor.backspace();
638604
638728
  case key4.delete:
638605
- return key4.meta ? killToLineEnd : () => cursor.del();
638729
+ return key4.super || key4.meta ? killToLineEnd : () => cursor.del();
638606
638730
  case key4.ctrl:
638607
638731
  return handleCtrl;
638608
638732
  case key4.home:
@@ -638665,7 +638789,13 @@ function useTextInput({
638665
638789
  if (key4.ctrl && (input2 === "k" || input2 === "u" || input2 === "w")) {
638666
638790
  return true;
638667
638791
  }
638668
- if (key4.meta && (key4.backspace || key4.delete)) {
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)) {
638669
638799
  return true;
638670
638800
  }
638671
638801
  return false;
@@ -649222,11 +649352,14 @@ var init_SearchBox = __esm(() => {
649222
649352
  });
649223
649353
 
649224
649354
  // src/hooks/useSearchInput.ts
649225
- function isKillKey(e4) {
649355
+ function isKillKey(e4, isReadline) {
649226
649356
  if (e4.ctrl && (e4.key === "k" || e4.key === "u" || e4.key === "w")) {
649227
649357
  return true;
649228
649358
  }
649229
- 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") {
649230
649363
  return true;
649231
649364
  }
649232
649365
  return false;
@@ -649257,15 +649390,15 @@ function useSearchInput({
649257
649390
  if (!isActive)
649258
649391
  return;
649259
649392
  const cursor = Cursor.fromText(query2, effectiveColumns, cursorOffset);
649260
- if (e4.ctrl && passthroughCtrlKeys.includes(e4.key.toLowerCase())) {
649261
- return;
649262
- }
649263
- if (!isKillKey(e4)) {
649393
+ if (!isKillKey(e4, isReadline)) {
649264
649394
  resetKillAccumulation();
649265
649395
  }
649266
649396
  if (!isYankKey(e4)) {
649267
649397
  resetYankState();
649268
649398
  }
649399
+ if (e4.ctrl && passthroughCtrlKeys.includes(e4.key.toLowerCase())) {
649400
+ return;
649401
+ }
649269
649402
  if (e4.key === "return" || e4.key === "down") {
649270
649403
  e4.preventDefault();
649271
649404
  onExit2();
@@ -649292,8 +649425,8 @@ function useSearchInput({
649292
649425
  }
649293
649426
  if (e4.key === "backspace") {
649294
649427
  e4.preventDefault();
649295
- if (e4.meta) {
649296
- const { cursor: newCursor2, killed } = cursor.deleteWordBefore();
649428
+ if (e4.meta || e4.ctrl) {
649429
+ const { cursor: newCursor2, killed } = isReadline ? cursor.backwardKillWord() : cursor.deleteWordBefore();
649297
649430
  pushToKillRing(killed, "prepend");
649298
649431
  setQueryState(newCursor2.text);
649299
649432
  setCursorOffset(newCursor2.offset);
@@ -649318,13 +649451,13 @@ function useSearchInput({
649318
649451
  }
649319
649452
  if (e4.key === "left" && (e4.ctrl || e4.meta || e4.fn)) {
649320
649453
  e4.preventDefault();
649321
- const newCursor = cursor.prevWord();
649454
+ const newCursor = isReadline ? cursor.backwardWord() : cursor.prevWord();
649322
649455
  setCursorOffset(newCursor.offset);
649323
649456
  return;
649324
649457
  }
649325
649458
  if (e4.key === "right" && (e4.ctrl || e4.meta || e4.fn)) {
649326
649459
  e4.preventDefault();
649327
- const newCursor = cursor.nextWord();
649460
+ const newCursor = isReadline ? cursor.forwardWord() : cursor.nextWord();
649328
649461
  setCursorOffset(newCursor.offset);
649329
649462
  return;
649330
649463
  }
@@ -649431,12 +649564,19 @@ function useSearchInput({
649431
649564
  e4.preventDefault();
649432
649565
  switch (e4.key.toLowerCase()) {
649433
649566
  case "b":
649434
- setCursorOffset(cursor.prevWord().offset);
649567
+ setCursorOffset((isReadline ? cursor.backwardWord() : cursor.prevWord()).offset);
649435
649568
  return;
649436
649569
  case "f":
649437
- setCursorOffset(cursor.nextWord().offset);
649570
+ setCursorOffset((isReadline ? cursor.forwardWord() : cursor.nextWord()).offset);
649438
649571
  return;
649439
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
+ }
649440
649580
  const newCursor = cursor.deleteWordAfter();
649441
649581
  setQueryState(newCursor.text);
649442
649582
  setCursorOffset(newCursor.offset);
@@ -769751,8 +769891,8 @@ function getOperatorRange(cursor, target, motion, op, count4) {
769751
769891
  } else if (isInclusiveMotion(motion) && cursor.offset <= target.offset) {
769752
769892
  to = cursor.measuredText.nextOffset(to);
769753
769893
  }
769754
- from2 = cursor.snapOutOfImageRef(from2, "start");
769755
- to = cursor.snapOutOfImageRef(to, "end");
769894
+ from2 = cursor.snapOutOfPlaceholder(from2, "start");
769895
+ to = cursor.snapOutOfPlaceholder(to, "end");
769756
769896
  return { from: from2, to, linewise };
769757
769897
  }
769758
769898
  function getOperatorRangeForFind(cursor, target, _findType) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cnwenf/occ",
3
- "version": "2.1.308",
3
+ "version": "2.1.309",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "bin": {