Skip to content

Commit 393d160

Browse files
committed
1 parent de78d5e commit 393d160

File tree

11 files changed

+50
-33
lines changed

11 files changed

+50
-33
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
"xterm": "5.2.0-beta.41",
9191
"xterm-addon-canvas": "0.4.0-beta.11",
9292
"xterm-addon-image": "0.4.0",
93-
"xterm-addon-search": "0.11.0",
93+
"xterm-addon-search": "0.12.0-beta.3",
9494
"xterm-addon-serialize": "0.9.0",
9595
"xterm-addon-unicode11": "0.5.0",
9696
"xterm-addon-webgl": "0.15.0-beta.10",

remote/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"xterm": "5.2.0-beta.41",
2828
"xterm-addon-canvas": "0.4.0-beta.11",
2929
"xterm-addon-image": "0.4.0",
30-
"xterm-addon-search": "0.11.0",
30+
"xterm-addon-search": "0.12.0-beta.3",
3131
"xterm-addon-serialize": "0.9.0",
3232
"xterm-addon-unicode11": "0.5.0",
3333
"xterm-addon-webgl": "0.15.0-beta.10",

remote/web/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"xterm": "5.2.0-beta.41",
1515
"xterm-addon-canvas": "0.4.0-beta.11",
1616
"xterm-addon-image": "0.4.0",
17-
"xterm-addon-search": "0.11.0",
17+
"xterm-addon-search": "0.12.0-beta.3",
1818
"xterm-addon-unicode11": "0.5.0",
1919
"xterm-addon-webgl": "0.15.0-beta.10"
2020
}

remote/web/yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ [email protected]:
7878
resolved "https://registry.yarnpkg.com/xterm-addon-image/-/xterm-addon-image-0.4.0.tgz#36e98fa892db11755a5f6e9654f924e876e29bf8"
7979
integrity sha512-3wumCJo4WTzxvecSMxJ7XtpVQeFe4gE2cdHCyUdo7zagVkS18YXJacGx6DjlAIccdJn6/LhGuD99xOSSvYx9Gw==
8080

81-
xterm-addon-search@0.11.0:
82-
version "0.11.0"
83-
resolved "https://registry.yarnpkg.com/xterm-addon-search/-/xterm-addon-search-0.11.0.tgz#2a00ff7f9848f6140e7c4d1782486b0b18b06e0d"
84-
integrity sha512-6U4uHXcQ7G5igsdaGqrJ9ehm7vep24bXqWxuy3AnIosXF2Z5uy2MvmYRyTGNembIqPV/x1YhBQ7uShtuqBHhOQ==
81+
xterm-addon-search@0.12.0-beta.3:
82+
version "0.12.0-beta.3"
83+
resolved "https://registry.yarnpkg.com/xterm-addon-search/-/xterm-addon-search-0.12.0-beta.3.tgz#9ced9431378d37f4b42010691eb5b76f66b8b9e5"
84+
integrity sha512-NgzmUP5/764+csltcteHvIoNOScQHkIXkwEj+KgQr4QR48qFZMq3iGybcvv6icJsGglvvdG7YRputyT35eCjpQ==
8585

8686
8787
version "0.5.0"

remote/yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -846,10 +846,10 @@ [email protected]:
846846
resolved "https://registry.yarnpkg.com/xterm-addon-image/-/xterm-addon-image-0.4.0.tgz#36e98fa892db11755a5f6e9654f924e876e29bf8"
847847
integrity sha512-3wumCJo4WTzxvecSMxJ7XtpVQeFe4gE2cdHCyUdo7zagVkS18YXJacGx6DjlAIccdJn6/LhGuD99xOSSvYx9Gw==
848848

849-
xterm-addon-search@0.11.0:
850-
version "0.11.0"
851-
resolved "https://registry.yarnpkg.com/xterm-addon-search/-/xterm-addon-search-0.11.0.tgz#2a00ff7f9848f6140e7c4d1782486b0b18b06e0d"
852-
integrity sha512-6U4uHXcQ7G5igsdaGqrJ9ehm7vep24bXqWxuy3AnIosXF2Z5uy2MvmYRyTGNembIqPV/x1YhBQ7uShtuqBHhOQ==
849+
xterm-addon-search@0.12.0-beta.3:
850+
version "0.12.0-beta.3"
851+
resolved "https://registry.yarnpkg.com/xterm-addon-search/-/xterm-addon-search-0.12.0-beta.3.tgz#9ced9431378d37f4b42010691eb5b76f66b8b9e5"
852+
integrity sha512-NgzmUP5/764+csltcteHvIoNOScQHkIXkwEj+KgQr4QR48qFZMq3iGybcvv6icJsGglvvdG7YRputyT35eCjpQ==
853853

854854
855855
version "0.9.0"

src/vs/workbench/contrib/codeEditor/browser/find/simpleFindWidget.css

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
border: 1px solid var(--vscode-contrastBorder);
3535
border-bottom-left-radius: 4px;
3636
border-bottom-right-radius: 4px;
37+
font-size: 12px;
3738
}
3839

3940
.monaco-workbench.reduce-motion .monaco-editor .find-widget {
@@ -57,9 +58,9 @@
5758
}
5859

5960
.monaco-workbench .simple-find-part .matchesCount {
60-
width: 68px;
61-
max-width: 68px;
62-
min-width: 68px;
61+
width: 73px;
62+
max-width: 73px;
63+
min-width: 73px;
6364
padding-left: 5px;
6465
}
6566

src/vs/workbench/contrib/codeEditor/browser/find/simpleFindWidget.ts

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ interface IFindOptions {
4141
}
4242

4343
const SIMPLE_FIND_WIDGET_INITIAL_WIDTH = 310;
44-
const MATCHES_COUNT_WIDTH = 68;
44+
const MATCHES_COUNT_WIDTH = 73;
4545

4646
export abstract class SimpleFindWidget extends Widget {
4747
private readonly _findInput: FindInput;
@@ -208,6 +208,10 @@ export abstract class SimpleFindWidget extends Widget {
208208
protected abstract _onFindInputFocusTrackerBlur(): void;
209209
protected abstract _getResultCount(): Promise<{ resultIndex: number; resultCount: number } | undefined>;
210210

211+
protected get _matchesLimit(): number {
212+
return Number.MAX_SAFE_INTEGER;
213+
}
214+
211215
protected get inputValue() {
212216
return this._findInput.getValue();
213217
}
@@ -251,7 +255,7 @@ export abstract class SimpleFindWidget extends Widget {
251255
}
252256

253257
this._isVisible = true;
254-
this.updateButtons(this._foundMatch);
258+
this.updateResultCount();
255259
this.layout();
256260

257261
setTimeout(() => {
@@ -354,15 +358,21 @@ export abstract class SimpleFindWidget extends Widget {
354358

355359
const count = await this._getResultCount();
356360
this._matchesCount.innerText = '';
361+
const showRedOutline = (this.inputValue.length > 0 && count?.resultCount === 0);
362+
this._matchesCount.classList.toggle('no-results', showRedOutline);
357363
let label = '';
358-
this._matchesCount.classList.toggle('no-results', false);
359-
if (count?.resultCount !== undefined && count?.resultCount === 0) {
360-
label = NLS_NO_RESULTS;
361-
if (!!this.inputValue) {
362-
this._matchesCount.classList.toggle('no-results', true);
364+
if (count?.resultCount) {
365+
let matchesCount: string = String(count.resultCount);
366+
if (count.resultCount >= this._matchesLimit) {
367+
matchesCount += '+';
368+
}
369+
let matchesPosition: string = String(count.resultIndex + 1);
370+
if (matchesPosition === '0') {
371+
matchesPosition = '?';
363372
}
364-
} else if (count?.resultCount) {
365-
label = strings.format(NLS_MATCHES_LOCATION, count.resultIndex + 1, count?.resultCount);
373+
label = strings.format(NLS_MATCHES_LOCATION, matchesPosition, matchesCount);
374+
} else {
375+
label = NLS_NO_RESULTS;
366376
}
367377
alertFn(this._announceSearchResults(label, this.inputValue));
368378
this._matchesCount.appendChild(document.createTextNode(label));

src/vs/workbench/contrib/terminal/browser/terminal.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -956,6 +956,10 @@ export interface ITerminalChildElement {
956956
xtermReady?(xterm: IXtermTerminal): void;
957957
}
958958

959+
export const enum XtermTerminalConstants {
960+
SearchHighlightLimit = 1000
961+
}
962+
959963
export interface IXtermTerminal {
960964
/**
961965
* An object that tracks when commands are run and enables navigating and selecting between
@@ -969,7 +973,7 @@ export interface IXtermTerminal {
969973
readonly shellIntegration: IShellIntegration;
970974

971975
readonly onDidChangeSelection: Event<void>;
972-
readonly onDidChangeFindResults: Event<{ resultIndex: number; resultCount: number } | undefined>;
976+
readonly onDidChangeFindResults: Event<{ resultIndex: number; resultCount: number }>;
973977

974978
/**
975979
* Gets a view of the current texture atlas used by the renderers.

src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { IEditorOptions } from 'vs/editor/common/config/editorOptions';
1818
import { IShellIntegration, TerminalSettingId } from 'vs/platform/terminal/common/terminal';
1919
import { ITerminalFont } from 'vs/workbench/contrib/terminal/common/terminal';
2020
import { isSafari } from 'vs/base/browser/browser';
21-
import { IMarkTracker, IInternalXtermTerminal, IXtermTerminal, ISuggestController, IXtermColorProvider } from 'vs/workbench/contrib/terminal/browser/terminal';
21+
import { IMarkTracker, IInternalXtermTerminal, IXtermTerminal, ISuggestController, IXtermColorProvider, XtermTerminalConstants } from 'vs/workbench/contrib/terminal/browser/terminal';
2222
import { ILogService } from 'vs/platform/log/common/log';
2323
import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage';
2424
import { TerminalStorageKeys } from 'vs/workbench/contrib/terminal/common/terminalStorageKeys';
@@ -152,7 +152,7 @@ export class XtermTerminal extends DisposableStore implements IXtermTerminal, II
152152
readonly onDidRequestSendText = this._onDidRequestSendText.event;
153153
private readonly _onDidRequestFreePort = new Emitter<string>();
154154
readonly onDidRequestFreePort = this._onDidRequestFreePort.event;
155-
private readonly _onDidChangeFindResults = new Emitter<{ resultIndex: number; resultCount: number } | undefined>();
155+
private readonly _onDidChangeFindResults = new Emitter<{ resultIndex: number; resultCount: number }>();
156156
readonly onDidChangeFindResults = this._onDidChangeFindResults.event;
157157
private readonly _onDidChangeSelection = new Emitter<void>();
158158
readonly onDidChangeSelection = this._onDidChangeSelection.event;
@@ -409,9 +409,9 @@ export class XtermTerminal extends DisposableStore implements IXtermTerminal, II
409409
return this._searchAddon;
410410
}
411411
const AddonCtor = await this._getSearchAddonConstructor();
412-
this._searchAddon = new AddonCtor();
412+
this._searchAddon = new AddonCtor({ highlightLimit: XtermTerminalConstants.SearchHighlightLimit });
413413
this.raw.loadAddon(this._searchAddon);
414-
this._searchAddon.onDidChangeResults((results: { resultIndex: number; resultCount: number } | undefined) => {
414+
this._searchAddon.onDidChangeResults((results: { resultIndex: number; resultCount: number }) => {
415415
this._lastFindResult = results;
416416
this._onDidChangeFindResults.fire(results);
417417
});

src/vs/workbench/contrib/terminalContrib/find/browser/terminalFindWidget.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import { SimpleFindWidget } from 'vs/workbench/contrib/codeEditor/browser/find/simpleFindWidget';
77
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
88
import { IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey';
9-
import { ITerminalInstance, IXtermTerminal } from 'vs/workbench/contrib/terminal/browser/terminal';
9+
import { ITerminalInstance, IXtermTerminal, XtermTerminalConstants } from 'vs/workbench/contrib/terminal/browser/terminal';
1010
import { TerminalContextKeys } from 'vs/workbench/contrib/terminal/common/terminalContextKey';
1111
import { IThemeService } from 'vs/platform/theme/common/themeService';
1212
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
@@ -19,6 +19,8 @@ export class TerminalFindWidget extends SimpleFindWidget {
1919
private _findWidgetFocused: IContextKey<boolean>;
2020
private _findWidgetVisible: IContextKey<boolean>;
2121

22+
override get _matchesLimit() { return XtermTerminalConstants.SearchHighlightLimit; }
23+
2224
constructor(
2325
private _instance: ITerminalInstance,
2426
@IContextViewService _contextViewService: IContextViewService,

0 commit comments

Comments
 (0)