提交 faee920b 编写于 作者: J Jackson Kearl

move cursor to 0,0 on search

上级 27c5c0c4
...@@ -587,7 +587,7 @@ export class ReRunSearchEditorSearchAction extends Action { ...@@ -587,7 +587,7 @@ export class ReRunSearchEditorSearchAction extends Action {
async run() { async run() {
const input = this.editorService.activeEditor; const input = this.editorService.activeEditor;
if (input instanceof SearchEditorInput) { if (input instanceof SearchEditorInput) {
await (this.editorService.activeControl as SearchEditor).runSearch(); await (this.editorService.activeControl as SearchEditor).runSearch(false, true);
} }
} }
} }
......
...@@ -96,9 +96,9 @@ export class SearchEditor extends BaseEditor { ...@@ -96,9 +96,9 @@ export class SearchEditor extends BaseEditor {
this.queryEditorWidget = this._register(this.instantiationService.createInstance(SearchWidget, this.queryEditorContainer, { _hideReplaceToggle: true, showContextToggle: true })); this.queryEditorWidget = this._register(this.instantiationService.createInstance(SearchWidget, this.queryEditorContainer, { _hideReplaceToggle: true, showContextToggle: true }));
this._register(this.queryEditorWidget.onReplaceToggled(() => this.reLayout())); this._register(this.queryEditorWidget.onReplaceToggled(() => this.reLayout()));
this._register(this.queryEditorWidget.onDidHeightChange(() => this.reLayout())); this._register(this.queryEditorWidget.onDidHeightChange(() => this.reLayout()));
this.queryEditorWidget.onSearchSubmit(() => this.runSearch(true)); // onSearchSubmit has an internal delayer, so skip over ours. this.queryEditorWidget.onSearchSubmit(() => this.runSearch(true, true)); // onSearchSubmit has an internal delayer, so skip over ours.
this.queryEditorWidget.searchInput.onDidOptionChange(() => this.runSearch()); this.queryEditorWidget.searchInput.onDidOptionChange(() => this.runSearch(false));
this.queryEditorWidget.onDidToggleContext(() => this.runSearch()); this.queryEditorWidget.onDidToggleContext(() => this.runSearch(false));
// Includes/Excludes Dropdown // Includes/Excludes Dropdown
this.includesExcludesContainer = DOM.append(this.queryEditorContainer, DOM.$('.includes-excludes')); this.includesExcludesContainer = DOM.append(this.queryEditorContainer, DOM.$('.includes-excludes'));
...@@ -217,26 +217,31 @@ export class SearchEditor extends BaseEditor { ...@@ -217,26 +217,31 @@ export class SearchEditor extends BaseEditor {
toggleWholeWords() { toggleWholeWords() {
this.queryEditorWidget.searchInput.setWholeWords(!this.queryEditorWidget.searchInput.getWholeWords()); this.queryEditorWidget.searchInput.setWholeWords(!this.queryEditorWidget.searchInput.getWholeWords());
this.runSearch(); this.runSearch(false);
} }
toggleRegex() { toggleRegex() {
this.queryEditorWidget.searchInput.setRegex(!this.queryEditorWidget.searchInput.getRegex()); this.queryEditorWidget.searchInput.setRegex(!this.queryEditorWidget.searchInput.getRegex());
this.runSearch(); this.runSearch(false);
} }
toggleCaseSensitive() { toggleCaseSensitive() {
this.queryEditorWidget.searchInput.setCaseSensitive(!this.queryEditorWidget.searchInput.getCaseSensitive()); this.queryEditorWidget.searchInput.setCaseSensitive(!this.queryEditorWidget.searchInput.getCaseSensitive());
this.runSearch(); this.runSearch(false);
} }
toggleContextLines() { toggleContextLines() {
this.queryEditorWidget.toggleContextLines(); this.queryEditorWidget.toggleContextLines();
} }
async runSearch(instant = false) { async runSearch(resetCursor = true, instant = false) {
if (!this.pauseSearching) { if (!this.pauseSearching) {
this.runSearchDelayer.trigger(() => this.doRunSearch(), instant ? 0 : undefined); this.runSearchDelayer.trigger(async () => {
await this.doRunSearch();
if (resetCursor) {
this.searchResultEditor.setSelection(new Range(1, 1, 1, 1));
}
}, instant ? 0 : undefined);
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册