@oh-my-pi/pi-tui 4.2.0 → 4.2.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oh-my-pi/pi-tui",
3
- "version": "4.2.0",
3
+ "version": "4.2.2",
4
4
  "description": "Terminal User Interface library with differential rendering for efficient text-based applications",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -95,7 +95,7 @@ export class CombinedAutocompleteProvider implements AutocompleteProvider {
95
95
  ) {
96
96
  this.commands = commands;
97
97
  this.basePath = basePath;
98
- this.fdPath = fdPath;
98
+ this.fdPath = fdPath ?? Bun.which("fd") ?? Bun.which("fdfind");
99
99
  }
100
100
 
101
101
  getSuggestions(
@@ -111,7 +111,12 @@ export class CombinedAutocompleteProvider implements AutocompleteProvider {
111
111
  if (atMatch) {
112
112
  const prefix = atMatch[1] ?? "@"; // The @... part
113
113
  const query = prefix.slice(1); // Remove the @
114
- const suggestions = this.getFuzzyFileSuggestions(query);
114
+ const suggestions = query.length > 0 ? this.getFuzzyFileSuggestions(query) : this.getFileSuggestions("@");
115
+ if (suggestions.length === 0 && query.length > 0) {
116
+ const fallback = this.getFileSuggestions(prefix);
117
+ if (fallback.length === 0) return null;
118
+ return { items: fallback, prefix };
119
+ }
115
120
  if (suggestions.length === 0) return null;
116
121
 
117
122
  return {
@@ -287,6 +287,7 @@ export class Editor implements Component {
287
287
  public onSubmit?: (text: string) => void;
288
288
  public onAltEnter?: (text: string) => void;
289
289
  public onChange?: (text: string) => void;
290
+ public onAutocompleteCancel?: () => void;
290
291
  public disableSubmit: boolean = false;
291
292
 
292
293
  // Custom top border (for status line integration)
@@ -581,7 +582,7 @@ export class Editor implements Component {
581
582
  if (this.isAutocompleting && this.autocompleteList) {
582
583
  // Escape - cancel autocomplete
583
584
  if (isEscape(data)) {
584
- this.cancelAutocomplete();
585
+ this.cancelAutocomplete(true);
585
586
  return;
586
587
  }
587
588
  // Let the autocomplete list handle navigation and selection
@@ -1571,10 +1572,14 @@ https://github.com/EsotericSoftware/spine-runtimes/actions/runs/19536643416/job/
1571
1572
  }
1572
1573
  }
1573
1574
 
1574
- private cancelAutocomplete(): void {
1575
+ private cancelAutocomplete(notifyCancel: boolean = false): void {
1576
+ const wasAutocompleting = this.isAutocompleting;
1575
1577
  this.isAutocompleting = false;
1576
1578
  this.autocompleteList = undefined;
1577
1579
  this.autocompletePrefix = "";
1580
+ if (notifyCancel && wasAutocompleting) {
1581
+ this.onAutocompleteCancel?.();
1582
+ }
1578
1583
  }
1579
1584
 
1580
1585
  public isShowingAutocomplete(): boolean {