@oh-my-pi/pi-tui 12.1.0 → 12.2.0
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/README.md +2 -1
- package/package.json +22 -17
- package/src/autocomplete.ts +2 -1
- package/src/components/editor.ts +2 -1
package/README.md
CHANGED
|
@@ -443,6 +443,7 @@ Supports both slash commands and file paths.
|
|
|
443
443
|
|
|
444
444
|
```typescript
|
|
445
445
|
import { CombinedAutocompleteProvider } from "@oh-my-pi/pi-tui";
|
|
446
|
+
import { getProjectDir } from "@oh-my-pi/pi-utils/dirs";
|
|
446
447
|
|
|
447
448
|
const provider = new CombinedAutocompleteProvider(
|
|
448
449
|
[
|
|
@@ -450,7 +451,7 @@ const provider = new CombinedAutocompleteProvider(
|
|
|
450
451
|
{ name: "clear", description: "Clear screen" },
|
|
451
452
|
{ name: "delete", description: "Delete last message" },
|
|
452
453
|
],
|
|
453
|
-
|
|
454
|
+
getProjectDir() // base path for file completion
|
|
454
455
|
);
|
|
455
456
|
|
|
456
457
|
editor.setAutocompleteProvider(provider);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oh-my-pi/pi-tui",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.2.0",
|
|
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",
|
|
@@ -36,26 +36,31 @@
|
|
|
36
36
|
"typescript",
|
|
37
37
|
"cli"
|
|
38
38
|
],
|
|
39
|
-
"author": "
|
|
39
|
+
"author": "Can Bölük",
|
|
40
|
+
"contributors": ["Mario Zechner"],
|
|
40
41
|
"license": "MIT",
|
|
41
42
|
"repository": {
|
|
42
43
|
"type": "git",
|
|
43
44
|
"url": "git+https://github.com/can1357/oh-my-pi.git",
|
|
44
45
|
"directory": "packages/tui"
|
|
45
46
|
},
|
|
46
|
-
"
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
"
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
47
|
+
"homepage": "https://github.com/can1357/oh-my-pi",
|
|
48
|
+
"bugs": {
|
|
49
|
+
"url": "https://github.com/can1357/oh-my-pi/issues"
|
|
50
|
+
},
|
|
51
|
+
"engines": {
|
|
52
|
+
"bun": ">=1.3.7"
|
|
53
|
+
},
|
|
54
|
+
"dependencies": {
|
|
55
|
+
"@oh-my-pi/pi-natives": "12.2.0",
|
|
56
|
+
"@oh-my-pi/pi-utils": "12.2.0",
|
|
57
|
+
"@types/mime-types": "^3.0.1",
|
|
58
|
+
"chalk": "^5.6.2",
|
|
59
|
+
"marked": "^17.0.1",
|
|
60
|
+
"mime-types": "^3.0.2"
|
|
61
|
+
},
|
|
62
|
+
"devDependencies": {
|
|
63
|
+
"@xterm/headless": "^6.0.0",
|
|
64
|
+
"@xterm/xterm": "^6.0.0"
|
|
65
|
+
}
|
|
61
66
|
}
|
package/src/autocomplete.ts
CHANGED
|
@@ -2,6 +2,7 @@ import * as fs from "node:fs";
|
|
|
2
2
|
import * as os from "node:os";
|
|
3
3
|
import * as path from "node:path";
|
|
4
4
|
import { fuzzyFind } from "@oh-my-pi/pi-natives";
|
|
5
|
+
import { getProjectDir } from "@oh-my-pi/pi-utils/dirs";
|
|
5
6
|
|
|
6
7
|
const PATH_DELIMITERS = new Set([" ", "\t", '"', "'", "="]);
|
|
7
8
|
|
|
@@ -203,7 +204,7 @@ export class CombinedAutocompleteProvider implements AutocompleteProvider {
|
|
|
203
204
|
#dirCache: Map<string, { entries: fs.Dirent[]; timestamp: number }> = new Map();
|
|
204
205
|
readonly #DIR_CACHE_TTL = 2000; // 2 seconds
|
|
205
206
|
|
|
206
|
-
constructor(commands: (SlashCommand | AutocompleteItem)[] = [], basePath: string =
|
|
207
|
+
constructor(commands: (SlashCommand | AutocompleteItem)[] = [], basePath: string = getProjectDir()) {
|
|
207
208
|
this.#commands = commands;
|
|
208
209
|
this.#basePath = basePath;
|
|
209
210
|
}
|
package/src/components/editor.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getProjectDir } from "@oh-my-pi/pi-utils/dirs";
|
|
1
2
|
import type { AutocompleteProvider, CombinedAutocompleteProvider } from "../autocomplete";
|
|
2
3
|
import { type EditorKeybindingsManager, getEditorKeybindings } from "../keybindings";
|
|
3
4
|
import { matchesKey } from "../keys";
|
|
@@ -419,7 +420,7 @@ export class Editor implements Component, Focusable {
|
|
|
419
420
|
this.#history.pop();
|
|
420
421
|
}
|
|
421
422
|
|
|
422
|
-
this.#historyStorage?.add(trimmed,
|
|
423
|
+
this.#historyStorage?.add(trimmed, getProjectDir());
|
|
423
424
|
}
|
|
424
425
|
|
|
425
426
|
#isEditorEmpty(): boolean {
|