提交 937eba4e 编写于 作者: A Alex Dima

Fixes #10650: Remember max rendered match count width

上级 e6bc800b
...@@ -115,7 +115,6 @@ ...@@ -115,7 +115,6 @@
display: inline-block; display: inline-block;
margin: 0 1px 0 3px; margin: 0 1px 0 3px;
padding: 2px 2px 0 2px; padding: 2px 2px 0 2px;
min-width: 69px;
height: 25px; height: 25px;
vertical-align: middle; vertical-align: middle;
box-sizing: border-box; box-sizing: border-box;
......
...@@ -43,6 +43,8 @@ const NLS_MATCHES_COUNT_LIMIT_TITLE = nls.localize('title.matchesCountLimit', "O ...@@ -43,6 +43,8 @@ const NLS_MATCHES_COUNT_LIMIT_TITLE = nls.localize('title.matchesCountLimit', "O
const NLS_MATCHES_LOCATION = nls.localize('label.matchesLocation', "{0} of {1}"); const NLS_MATCHES_LOCATION = nls.localize('label.matchesLocation', "{0} of {1}");
const NLS_NO_RESULTS = nls.localize('label.noResults', "No results"); const NLS_NO_RESULTS = nls.localize('label.noResults', "No results");
let MAX_MATCHES_COUNT_WIDTH = 69;
export class FindWidget extends Widget implements IOverlayWidget { export class FindWidget extends Widget implements IOverlayWidget {
private static ID = 'editor.contrib.findWidget'; private static ID = 'editor.contrib.findWidget';
...@@ -200,6 +202,7 @@ export class FindWidget extends Widget implements IOverlayWidget { ...@@ -200,6 +202,7 @@ export class FindWidget extends Widget implements IOverlayWidget {
} }
private _updateMatchesCount(): void { private _updateMatchesCount(): void {
this._matchesCount.style.minWidth = MAX_MATCHES_COUNT_WIDTH + 'px';
if (this._state.matchesCount >= MATCHES_LIMIT) { if (this._state.matchesCount >= MATCHES_LIMIT) {
this._matchesCount.title = NLS_MATCHES_COUNT_LIMIT_TITLE; this._matchesCount.title = NLS_MATCHES_COUNT_LIMIT_TITLE;
} else { } else {
...@@ -226,6 +229,8 @@ export class FindWidget extends Widget implements IOverlayWidget { ...@@ -226,6 +229,8 @@ export class FindWidget extends Widget implements IOverlayWidget {
label = NLS_NO_RESULTS; label = NLS_NO_RESULTS;
} }
this._matchesCount.appendChild(document.createTextNode(label)); this._matchesCount.appendChild(document.createTextNode(label));
MAX_MATCHES_COUNT_WIDTH = Math.max(MAX_MATCHES_COUNT_WIDTH, this._matchesCount.clientWidth);
} }
// ----- actions // ----- actions
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册