Skip to content

Commit 34a283a

Browse files
authored
Merge pull request microsoft#210706 from microsoft/tyriar/update_cursor_still
PromptInputModel: Update model when prompt changes without cursor movement
2 parents 0b20783 + eb43e19 commit 34a283a

File tree

8 files changed

+234
-200
lines changed

8 files changed

+234
-200
lines changed

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,14 @@
8181
"@vscode/windows-mutex": "^0.5.0",
8282
"@vscode/windows-process-tree": "^0.6.0",
8383
"@vscode/windows-registry": "^1.1.0",
84-
"@xterm/addon-canvas": "0.8.0-beta.2",
85-
"@xterm/addon-image": "0.9.0-beta.2",
86-
"@xterm/addon-search": "0.16.0-beta.2",
87-
"@xterm/addon-serialize": "0.14.0-beta.2",
88-
"@xterm/addon-unicode11": "0.9.0-beta.2",
89-
"@xterm/addon-webgl": "0.19.0-beta.2",
90-
"@xterm/headless": "5.6.0-beta.2",
91-
"@xterm/xterm": "5.6.0-beta.2",
84+
"@xterm/addon-canvas": "0.8.0-beta.3",
85+
"@xterm/addon-image": "0.9.0-beta.3",
86+
"@xterm/addon-search": "0.16.0-beta.3",
87+
"@xterm/addon-serialize": "0.14.0-beta.3",
88+
"@xterm/addon-unicode11": "0.9.0-beta.3",
89+
"@xterm/addon-webgl": "0.19.0-beta.3",
90+
"@xterm/headless": "5.6.0-beta.3",
91+
"@xterm/xterm": "5.6.0-beta.3",
9292
"graceful-fs": "4.2.11",
9393
"http-proxy-agent": "^7.0.0",
9494
"https-proxy-agent": "^7.0.2",

remote/package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
"@vscode/vscode-languagedetection": "1.0.21",
1414
"@vscode/windows-process-tree": "^0.6.0",
1515
"@vscode/windows-registry": "^1.1.0",
16-
"@xterm/addon-canvas": "0.8.0-beta.2",
17-
"@xterm/addon-image": "0.9.0-beta.2",
18-
"@xterm/addon-search": "0.16.0-beta.2",
19-
"@xterm/addon-serialize": "0.14.0-beta.2",
20-
"@xterm/addon-unicode11": "0.9.0-beta.2",
21-
"@xterm/addon-webgl": "0.19.0-beta.2",
22-
"@xterm/headless": "5.6.0-beta.2",
23-
"@xterm/xterm": "5.6.0-beta.2",
16+
"@xterm/addon-canvas": "0.8.0-beta.3",
17+
"@xterm/addon-image": "0.9.0-beta.3",
18+
"@xterm/addon-search": "0.16.0-beta.3",
19+
"@xterm/addon-serialize": "0.14.0-beta.3",
20+
"@xterm/addon-unicode11": "0.9.0-beta.3",
21+
"@xterm/addon-webgl": "0.19.0-beta.3",
22+
"@xterm/headless": "5.6.0-beta.3",
23+
"@xterm/xterm": "5.6.0-beta.3",
2424
"cookie": "^0.4.0",
2525
"graceful-fs": "4.2.11",
2626
"http-proxy-agent": "^7.0.0",

remote/web/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
"@microsoft/1ds-post-js": "^3.2.13",
88
"@vscode/iconv-lite-umd": "0.7.0",
99
"@vscode/vscode-languagedetection": "1.0.21",
10-
"@xterm/addon-canvas": "0.8.0-beta.2",
11-
"@xterm/addon-image": "0.9.0-beta.2",
12-
"@xterm/addon-search": "0.16.0-beta.2",
13-
"@xterm/addon-serialize": "0.14.0-beta.2",
14-
"@xterm/addon-unicode11": "0.9.0-beta.2",
15-
"@xterm/addon-webgl": "0.19.0-beta.2",
16-
"@xterm/xterm": "5.6.0-beta.2",
10+
"@xterm/addon-canvas": "0.8.0-beta.3",
11+
"@xterm/addon-image": "0.9.0-beta.3",
12+
"@xterm/addon-search": "0.16.0-beta.3",
13+
"@xterm/addon-serialize": "0.14.0-beta.3",
14+
"@xterm/addon-unicode11": "0.9.0-beta.3",
15+
"@xterm/addon-webgl": "0.19.0-beta.3",
16+
"@xterm/xterm": "5.6.0-beta.3",
1717
"jschardet": "3.0.0",
1818
"tas-client-umd": "0.1.8",
1919
"vscode-oniguruma": "1.7.0",

remote/web/yarn.lock

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -48,40 +48,40 @@
4848
resolved "https://registry.yarnpkg.com/@vscode/vscode-languagedetection/-/vscode-languagedetection-1.0.21.tgz#89b48f293f6aa3341bb888c1118d16ff13b032d3"
4949
integrity sha512-zSUH9HYCw5qsCtd7b31yqkpaCU6jhtkKLkvOOA8yTrIRfBSOFb8PPhgmMicD7B/m+t4PwOJXzU1XDtrM9Fd3/g==
5050

51-
"@xterm/[email protected].2":
52-
version "0.8.0-beta.2"
53-
resolved "https://registry.yarnpkg.com/@xterm/addon-canvas/-/addon-canvas-0.8.0-beta.2.tgz#1149d9d174a984d5028fdf18f9291a1e047ed523"
54-
integrity sha512-+ujhLzqrFvG8WyQoVLjXnLCMC5xiIVNp7R/fc1xdHd0HGMz2cqoCSgkMxsv6GK3SJK18ESncXSDbwcZ6hGoO4g==
55-
56-
"@xterm/[email protected].2":
57-
version "0.9.0-beta.2"
58-
resolved "https://registry.yarnpkg.com/@xterm/addon-image/-/addon-image-0.9.0-beta.2.tgz#b77fa85dc5567ad199b4b1310d82fe29a1497392"
59-
integrity sha512-wDzXA8b+IxUZHoGmG5eG2vL+7YrWh8+Edd8bkF+IdzJXH8OFCGCi2nLxMWkLBGf/FvBoGBbhNtUZ4DrgfC6QRw==
60-
61-
"@xterm/[email protected].2":
62-
version "0.16.0-beta.2"
63-
resolved "https://registry.yarnpkg.com/@xterm/addon-search/-/addon-search-0.16.0-beta.2.tgz#3d6538d681bb198ead9e6896ff041d687055f540"
64-
integrity sha512-PdbHtE33xkfaYD3U5pBatZaBR5udGrdRwsGeN5IOddPoYegXm63x8k2nlCK+moYprWKA9xs8mEAOYom0hHAR4w==
65-
66-
"@xterm/[email protected].2":
67-
version "0.14.0-beta.2"
68-
resolved "https://registry.yarnpkg.com/@xterm/addon-serialize/-/addon-serialize-0.14.0-beta.2.tgz#79efb4c2ee668628ef10060e6d7d95488ee316d6"
69-
integrity sha512-6A1NYh0kaYKjOvml9FXevVpHVVOqC6uVDhg9G/ZUP5vyyu32z3MJ9CsOuQx1Jr3okCLpBa2IIzGZjz/Bsx0LUg==
70-
71-
"@xterm/[email protected].2":
72-
version "0.9.0-beta.2"
73-
resolved "https://registry.yarnpkg.com/@xterm/addon-unicode11/-/addon-unicode11-0.9.0-beta.2.tgz#9c7197b7aad6a0d6bbb710a3283a67bba1d9ee6e"
74-
integrity sha512-Ylet0mqkUpbO46jC0A1Zhd6udrV/dp9ZcpfCs/n57PripJ3ViHBi3UrjvUmalzeynMtgEG9gdGY9Df2j7aahsw==
75-
76-
"@xterm/[email protected].2":
77-
version "0.19.0-beta.2"
78-
resolved "https://registry.yarnpkg.com/@xterm/addon-webgl/-/addon-webgl-0.19.0-beta.2.tgz#413dcb35910898855b1a61eb633c2aa701481beb"
79-
integrity sha512-gvDeIjyss9koLtLpt/9JumkBm+dH0iBUSmQsuvRLn++hR+5XTnGbTmCuE6MxlC+37XZTH8PGGRdsacNW1aafSA==
80-
81-
"@xterm/[email protected].2":
82-
version "5.6.0-beta.2"
83-
resolved "https://registry.yarnpkg.com/@xterm/xterm/-/xterm-5.6.0-beta.2.tgz#a082549579cce0c3d581a3968c1e71b02c89f0c3"
84-
integrity sha512-LU8WEYR7oBlxA22bdF3CTl4K5IuorwgVKD3jFAuyH+ESCmsDHX7bO4GP5nG2IrSsbjWEGMXPzlYcehObdCPTfw==
51+
"@xterm/[email protected].3":
52+
version "0.8.0-beta.3"
53+
resolved "https://registry.yarnpkg.com/@xterm/addon-canvas/-/addon-canvas-0.8.0-beta.3.tgz#f7a8eb4804a51064e865fd180c41c52c19e328b1"
54+
integrity sha512-r69V8Criiz26SSzrQJrKhNQalpux6ae0rsm7WYK9uiN//mwaOZg7wcYlfCtTV3qmuLFJdfRZ2LKIiL4mZGThwQ==
55+
56+
"@xterm/[email protected].3":
57+
version "0.9.0-beta.3"
58+
resolved "https://registry.yarnpkg.com/@xterm/addon-image/-/addon-image-0.9.0-beta.3.tgz#1781ae5e2c2ae741e97dbba774712051737aaf89"
59+
integrity sha512-dxRwHGOnduZGEu90evCY6YeeQ5PKC/3G/hslh9ST2ThSHYwoApglaYYvsrhfdfh3fVI+CAMt2LYwQMixIe/FMg==
60+
61+
"@xterm/[email protected].3":
62+
version "0.16.0-beta.3"
63+
resolved "https://registry.yarnpkg.com/@xterm/addon-search/-/addon-search-0.16.0-beta.3.tgz#5ddd65522ca6055806a31ed6bcb8ab7454d070ed"
64+
integrity sha512-b4FrI++0eZkjr8BMvKhHZCg7G8FCLo5CNHUHFZsGyMTxICvFs+peugFH591ChCky9RkuHjpzay7Wfmf9ZAiScw==
65+
66+
"@xterm/[email protected].3":
67+
version "0.14.0-beta.3"
68+
resolved "https://registry.yarnpkg.com/@xterm/addon-serialize/-/addon-serialize-0.14.0-beta.3.tgz#2b9fc8787c7396fa43de8480dc9e8f99d78ea474"
69+
integrity sha512-ANx29m+EsNTmsISuHeboXICmf+hYoG07CRwfj+J08us+xUd3JH/I3DDO/toaD0XVGmF8YjhjAxYwo1pD6X+keg==
70+
71+
"@xterm/[email protected].3":
72+
version "0.9.0-beta.3"
73+
resolved "https://registry.yarnpkg.com/@xterm/addon-unicode11/-/addon-unicode11-0.9.0-beta.3.tgz#33024c1ced4abde9c3536155e4d28e39e395ed9b"
74+
integrity sha512-KDykY87GuxRaVUBpWphpK2tFIjsGw8TW16XI5XlZeuiNisSdXY3qX9NtSuW7kfAn0GYwsBjQQ6DjEzz5/q4Wtg==
75+
76+
"@xterm/[email protected].3":
77+
version "0.19.0-beta.3"
78+
resolved "https://registry.yarnpkg.com/@xterm/addon-webgl/-/addon-webgl-0.19.0-beta.3.tgz#c2b207486fe177e69b8e42c4d52d914c54f8db9a"
79+
integrity sha512-U/JCrmQHKxg8eQnbpWE7CNh+trsfxXJlEUSzG1xTYL4eifQNzrKVd3cczH8eKVO8SteSmJyQdNkHSjvVd4XWuA==
80+
81+
"@xterm/[email protected].3":
82+
version "5.6.0-beta.3"
83+
resolved "https://registry.yarnpkg.com/@xterm/xterm/-/xterm-5.6.0-beta.3.tgz#e526fd0cc10154656cb87b9e1b96e3f21f057f03"
84+
integrity sha512-3527Zuwf36llsIeVgMtKLA4dklRq7poEO2yINkQQSJ8PjtnRcH8kOdORQb6aAg0cKtKWg1LBIqmqoHWb+wvq6Q==
8585

8686
8787
version "3.0.0"

remote/yarn.lock

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -114,45 +114,45 @@
114114
resolved "https://registry.yarnpkg.com/@vscode/windows-registry/-/windows-registry-1.1.0.tgz#03dace7c29c46f658588b9885b9580e453ad21f9"
115115
integrity sha512-5AZzuWJpGscyiMOed0IuyEwt6iKmV5Us7zuwCDCFYMIq7tsvooO9BUiciywsvuthGz6UG4LSpeDeCxvgMVhnIw==
116116

117-
"@xterm/[email protected].2":
118-
version "0.8.0-beta.2"
119-
resolved "https://registry.yarnpkg.com/@xterm/addon-canvas/-/addon-canvas-0.8.0-beta.2.tgz#1149d9d174a984d5028fdf18f9291a1e047ed523"
120-
integrity sha512-+ujhLzqrFvG8WyQoVLjXnLCMC5xiIVNp7R/fc1xdHd0HGMz2cqoCSgkMxsv6GK3SJK18ESncXSDbwcZ6hGoO4g==
121-
122-
"@xterm/[email protected].2":
123-
version "0.9.0-beta.2"
124-
resolved "https://registry.yarnpkg.com/@xterm/addon-image/-/addon-image-0.9.0-beta.2.tgz#b77fa85dc5567ad199b4b1310d82fe29a1497392"
125-
integrity sha512-wDzXA8b+IxUZHoGmG5eG2vL+7YrWh8+Edd8bkF+IdzJXH8OFCGCi2nLxMWkLBGf/FvBoGBbhNtUZ4DrgfC6QRw==
126-
127-
"@xterm/[email protected].2":
128-
version "0.16.0-beta.2"
129-
resolved "https://registry.yarnpkg.com/@xterm/addon-search/-/addon-search-0.16.0-beta.2.tgz#3d6538d681bb198ead9e6896ff041d687055f540"
130-
integrity sha512-PdbHtE33xkfaYD3U5pBatZaBR5udGrdRwsGeN5IOddPoYegXm63x8k2nlCK+moYprWKA9xs8mEAOYom0hHAR4w==
131-
132-
"@xterm/[email protected].2":
133-
version "0.14.0-beta.2"
134-
resolved "https://registry.yarnpkg.com/@xterm/addon-serialize/-/addon-serialize-0.14.0-beta.2.tgz#79efb4c2ee668628ef10060e6d7d95488ee316d6"
135-
integrity sha512-6A1NYh0kaYKjOvml9FXevVpHVVOqC6uVDhg9G/ZUP5vyyu32z3MJ9CsOuQx1Jr3okCLpBa2IIzGZjz/Bsx0LUg==
136-
137-
"@xterm/[email protected].2":
138-
version "0.9.0-beta.2"
139-
resolved "https://registry.yarnpkg.com/@xterm/addon-unicode11/-/addon-unicode11-0.9.0-beta.2.tgz#9c7197b7aad6a0d6bbb710a3283a67bba1d9ee6e"
140-
integrity sha512-Ylet0mqkUpbO46jC0A1Zhd6udrV/dp9ZcpfCs/n57PripJ3ViHBi3UrjvUmalzeynMtgEG9gdGY9Df2j7aahsw==
141-
142-
"@xterm/[email protected].2":
143-
version "0.19.0-beta.2"
144-
resolved "https://registry.yarnpkg.com/@xterm/addon-webgl/-/addon-webgl-0.19.0-beta.2.tgz#413dcb35910898855b1a61eb633c2aa701481beb"
145-
integrity sha512-gvDeIjyss9koLtLpt/9JumkBm+dH0iBUSmQsuvRLn++hR+5XTnGbTmCuE6MxlC+37XZTH8PGGRdsacNW1aafSA==
146-
147-
"@xterm/[email protected].2":
148-
version "5.6.0-beta.2"
149-
resolved "https://registry.yarnpkg.com/@xterm/headless/-/headless-5.6.0-beta.2.tgz#ece64150cabec47662fc7c5b5b76e02dc485ee68"
150-
integrity sha512-NB6YYRdSt10xgGbVgjNtKc57LzvHxDV+BjxTmm3OYIa/37Bn4RH6EFcwTv/LVEay3SvkyUR4VAYzITQXyZJ2VQ==
151-
152-
"@xterm/[email protected].2":
153-
version "5.6.0-beta.2"
154-
resolved "https://registry.yarnpkg.com/@xterm/xterm/-/xterm-5.6.0-beta.2.tgz#a082549579cce0c3d581a3968c1e71b02c89f0c3"
155-
integrity sha512-LU8WEYR7oBlxA22bdF3CTl4K5IuorwgVKD3jFAuyH+ESCmsDHX7bO4GP5nG2IrSsbjWEGMXPzlYcehObdCPTfw==
117+
"@xterm/[email protected].3":
118+
version "0.8.0-beta.3"
119+
resolved "https://registry.yarnpkg.com/@xterm/addon-canvas/-/addon-canvas-0.8.0-beta.3.tgz#f7a8eb4804a51064e865fd180c41c52c19e328b1"
120+
integrity sha512-r69V8Criiz26SSzrQJrKhNQalpux6ae0rsm7WYK9uiN//mwaOZg7wcYlfCtTV3qmuLFJdfRZ2LKIiL4mZGThwQ==
121+
122+
"@xterm/[email protected].3":
123+
version "0.9.0-beta.3"
124+
resolved "https://registry.yarnpkg.com/@xterm/addon-image/-/addon-image-0.9.0-beta.3.tgz#1781ae5e2c2ae741e97dbba774712051737aaf89"
125+
integrity sha512-dxRwHGOnduZGEu90evCY6YeeQ5PKC/3G/hslh9ST2ThSHYwoApglaYYvsrhfdfh3fVI+CAMt2LYwQMixIe/FMg==
126+
127+
"@xterm/[email protected].3":
128+
version "0.16.0-beta.3"
129+
resolved "https://registry.yarnpkg.com/@xterm/addon-search/-/addon-search-0.16.0-beta.3.tgz#5ddd65522ca6055806a31ed6bcb8ab7454d070ed"
130+
integrity sha512-b4FrI++0eZkjr8BMvKhHZCg7G8FCLo5CNHUHFZsGyMTxICvFs+peugFH591ChCky9RkuHjpzay7Wfmf9ZAiScw==
131+
132+
"@xterm/[email protected].3":
133+
version "0.14.0-beta.3"
134+
resolved "https://registry.yarnpkg.com/@xterm/addon-serialize/-/addon-serialize-0.14.0-beta.3.tgz#2b9fc8787c7396fa43de8480dc9e8f99d78ea474"
135+
integrity sha512-ANx29m+EsNTmsISuHeboXICmf+hYoG07CRwfj+J08us+xUd3JH/I3DDO/toaD0XVGmF8YjhjAxYwo1pD6X+keg==
136+
137+
"@xterm/[email protected].3":
138+
version "0.9.0-beta.3"
139+
resolved "https://registry.yarnpkg.com/@xterm/addon-unicode11/-/addon-unicode11-0.9.0-beta.3.tgz#33024c1ced4abde9c3536155e4d28e39e395ed9b"
140+
integrity sha512-KDykY87GuxRaVUBpWphpK2tFIjsGw8TW16XI5XlZeuiNisSdXY3qX9NtSuW7kfAn0GYwsBjQQ6DjEzz5/q4Wtg==
141+
142+
"@xterm/[email protected].3":
143+
version "0.19.0-beta.3"
144+
resolved "https://registry.yarnpkg.com/@xterm/addon-webgl/-/addon-webgl-0.19.0-beta.3.tgz#c2b207486fe177e69b8e42c4d52d914c54f8db9a"
145+
integrity sha512-U/JCrmQHKxg8eQnbpWE7CNh+trsfxXJlEUSzG1xTYL4eifQNzrKVd3cczH8eKVO8SteSmJyQdNkHSjvVd4XWuA==
146+
147+
"@xterm/[email protected].3":
148+
version "5.6.0-beta.3"
149+
resolved "https://registry.yarnpkg.com/@xterm/headless/-/headless-5.6.0-beta.3.tgz#652d0ed494ea0c86e83d1167e2e5688c8b849401"
150+
integrity sha512-ei/DRvHPA5TsR/RpRWM9Eo8BeSzPzgszydBgZqfcagVpw69PMcziFBaNU77NSQCdYPKKaLaOuGcnVCZpvKEYPw==
151+
152+
"@xterm/[email protected].3":
153+
version "5.6.0-beta.3"
154+
resolved "https://registry.yarnpkg.com/@xterm/xterm/-/xterm-5.6.0-beta.3.tgz#e526fd0cc10154656cb87b9e1b96e3f21f057f03"
155+
integrity sha512-3527Zuwf36llsIeVgMtKLA4dklRq7poEO2yINkQQSJ8PjtnRcH8kOdORQb6aAg0cKtKWg1LBIqmqoHWb+wvq6Q==
156156

157157
agent-base@^7.0.1, agent-base@^7.0.2, agent-base@^7.1.0:
158158
version "7.1.0"

src/vs/platform/terminal/common/capabilities/commandDetection/promptInputModel.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { Emitter, type Event } from 'vs/base/common/event';
6+
import { Emitter, Event } from 'vs/base/common/event';
77
import { Disposable } from 'vs/base/common/lifecycle';
88
import { ILogService, LogLevel } from 'vs/platform/log/common/log';
99
import type { ITerminalCommand } from 'vs/platform/terminal/common/capabilities/capabilities';
10-
import { debounce } from 'vs/base/common/decorators';
10+
import { throttle } from 'vs/base/common/decorators';
1111

1212
// Importing types is safe in any layer
1313
// eslint-disable-next-line local/code-import-patterns
@@ -67,7 +67,10 @@ export class PromptInputModel extends Disposable implements IPromptInputModel {
6767
super();
6868

6969
this._register(this._xterm.onData(e => this._handleInput(e)));
70-
this._register(this._xterm.onCursorMove(() => this._sync()));
70+
this._register(Event.any(
71+
this._xterm.onWriteParsed,
72+
this._xterm.onCursorMove,
73+
)(() => this._sync()));
7174

7275
this._register(onCommandStart(e => this._handleCommandStart(e as { marker: IMarker })));
7376
this._register(onCommandExecuted(() => this._handleCommandExecuted()));
@@ -79,6 +82,9 @@ export class PromptInputModel extends Disposable implements IPromptInputModel {
7982

8083
getCombinedString(): string {
8184
const value = this._value.replaceAll('\n', '\u23CE');
85+
if (this._cursorIndex === -1) {
86+
return value;
87+
}
8288
let result = `${value.substring(0, this.cursorIndex)}|`;
8389
if (this.ghostTextIndex !== -1) {
8490
result += `${value.substring(this.cursorIndex, this.ghostTextIndex)}[`;
@@ -108,19 +114,16 @@ export class PromptInputModel extends Disposable implements IPromptInputModel {
108114
}
109115

110116
this._state = PromptInputState.Execute;
117+
this._cursorIndex = -1;
111118
this._onDidFinishInput.fire();
112119
}
113120

114121
private _handleInput(data: string) {
115122
this._sync();
116123
}
117124

118-
@debounce(50)
125+
@throttle(0)
119126
private _sync() {
120-
this._syncNow();
121-
}
122-
123-
protected _syncNow() {
124127
if (this._state !== PromptInputState.Input) {
125128
return;
126129
}

0 commit comments

Comments
 (0)