xshell 1.2.66 → 1.2.67
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 +1 -1
- package/path.d.ts +2 -2
- package/prototype.browser.js +7 -7
- package/prototype.common.d.ts +4 -3
- package/prototype.js +7 -7
package/package.json
CHANGED
package/path.d.ts
CHANGED
|
@@ -54,7 +54,7 @@ export declare function extname(path: string): string;
|
|
|
54
54
|
/** `/` */
|
|
55
55
|
export declare const sep = "/";
|
|
56
56
|
/** The platform-specific file delimiter. ';' or ':'. */
|
|
57
|
-
export declare const delimiter: "
|
|
57
|
+
export declare const delimiter: ":" | ";";
|
|
58
58
|
/** Returns an object from a path string - the opposite of format().
|
|
59
59
|
@param path path to evaluate.
|
|
60
60
|
@throws {TypeError} if `path` is not a string. */
|
|
@@ -81,7 +81,7 @@ export declare let path: {
|
|
|
81
81
|
basename: typeof basename;
|
|
82
82
|
extname: typeof extname;
|
|
83
83
|
sep: string;
|
|
84
|
-
delimiter: "
|
|
84
|
+
delimiter: ":" | ";";
|
|
85
85
|
parse: typeof parse;
|
|
86
86
|
format: typeof format;
|
|
87
87
|
toNamespacedPath: typeof toNamespacedPath;
|
package/prototype.browser.js
CHANGED
|
@@ -23,12 +23,12 @@ if (!globalThis.my_prototype_defined) {
|
|
|
23
23
|
}),
|
|
24
24
|
// ------------ 文本处理工具方法
|
|
25
25
|
...to_method_property_descriptors({
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
truncate(width, storage = false) {
|
|
27
|
+
if (storage)
|
|
28
|
+
return this.length <= width ?
|
|
29
|
+
this
|
|
30
|
+
:
|
|
31
|
+
this.slice(0, width - 2) + '··';
|
|
32
32
|
const color_bak = this.startsWith('\u001b') ? this.slice(0, 5) : '';
|
|
33
33
|
if (width <= 2)
|
|
34
34
|
return this.slice(0, width);
|
|
@@ -52,7 +52,7 @@ if (!globalThis.my_prototype_defined) {
|
|
|
52
52
|
cur_width += w;
|
|
53
53
|
if (cur_width > width) {
|
|
54
54
|
const i_fitted_next = i_fitted + 1;
|
|
55
|
-
const t = this.slice(0, i_fitted_next) + ' '.repeat(width - 2 - fitted_width) + '
|
|
55
|
+
const t = this.slice(0, i_fitted_next) + ' '.repeat(width - 2 - fitted_width) + '··';
|
|
56
56
|
return color_bak ? color_bak + t + '\u001b[39m' : t;
|
|
57
57
|
}
|
|
58
58
|
}
|
package/prototype.common.d.ts
CHANGED
|
@@ -4,11 +4,12 @@ declare global {
|
|
|
4
4
|
interface String {
|
|
5
5
|
readonly width: number;
|
|
6
6
|
/** 截取字符串不超过 width 显示宽度的部分,并保留颜色
|
|
7
|
-
找到并记录能容纳 字符串 +
|
|
7
|
+
找到并记录能容纳 字符串 + ·· 的最后一个字符的位置 i_fitted
|
|
8
8
|
若完整的字符串长度超过 width,返回 slice(0, i_fitted + 1) + …
|
|
9
9
|
否则 返回 this
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
- width: 显示宽度或者存储长度
|
|
11
|
+
- storage?: 根据存储长度(width 作为 length)来截取 */
|
|
12
|
+
truncate(this: string, width: number, storage?: boolean): string;
|
|
12
13
|
/** pad string to `<width>`
|
|
13
14
|
- character?: `' '`
|
|
14
15
|
- position?: `'right'` */
|
package/prototype.js
CHANGED
|
@@ -25,12 +25,12 @@ if (!globalThis.my_prototype_defined) {
|
|
|
25
25
|
}),
|
|
26
26
|
// ------------ 文本处理工具方法
|
|
27
27
|
...to_method_property_descriptors({
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
truncate(width, storage = false) {
|
|
29
|
+
if (storage)
|
|
30
|
+
return this.length <= width ?
|
|
31
|
+
this
|
|
32
|
+
:
|
|
33
|
+
this.slice(0, width - 2) + '··';
|
|
34
34
|
const color_bak = this.startsWith('\u001b') ? this.slice(0, 5) : '';
|
|
35
35
|
const s = strip_ansi(this);
|
|
36
36
|
if (width <= 2)
|
|
@@ -55,7 +55,7 @@ if (!globalThis.my_prototype_defined) {
|
|
|
55
55
|
cur_width += w;
|
|
56
56
|
if (cur_width > width) {
|
|
57
57
|
const i_fitted_next = i_fitted + 1;
|
|
58
|
-
// … 在 winterm 中对不齐,使用
|
|
58
|
+
// … 在 winterm 中对不齐,使用 ·· 代替
|
|
59
59
|
const t = s.slice(0, i_fitted_next) + ' '.repeat(width - 2 - fitted_width) + '··';
|
|
60
60
|
return color_bak ? color_bak + t + '\u001b[39m' : t;
|
|
61
61
|
}
|