Include incremental in getSearchOptions

This commit is contained in:
Daniel Imms
2019-07-24 16:09:57 -07:00
parent d104f39a9d
commit db936701f4
+5 -8
View File
@@ -58,11 +58,12 @@ function setPadding(): void {
term.fit(); term.fit();
} }
function getSearchOptions(): ISearchOptions { function getSearchOptions(e: KeyboardEvent): ISearchOptions {
return { return {
regex: (document.getElementById('regex') as HTMLInputElement).checked, regex: (document.getElementById('regex') as HTMLInputElement).checked,
wholeWord: (document.getElementById('whole-word') as HTMLInputElement).checked, wholeWord: (document.getElementById('whole-word') as HTMLInputElement).checked,
caseSensitive: (document.getElementById('case-sensitive') as HTMLInputElement).checked caseSensitive: (document.getElementById('case-sensitive') as HTMLInputElement).checked,
incremental: e.key !== `Enter`
}; };
} }
@@ -134,15 +135,11 @@ function createTerminal(): void {
addDomListener(paddingElement, 'change', setPadding); addDomListener(paddingElement, 'change', setPadding);
addDomListener(actionElements.findNext, 'keyup', (e) => { addDomListener(actionElements.findNext, 'keyup', (e) => {
const searchOptions = getSearchOptions(); searchAddon.findNext(actionElements.findNext.value, getSearchOptions(e));
searchOptions.incremental = e.key !== `Enter`;
searchAddon.findNext(actionElements.findNext.value, searchOptions);
}); });
addDomListener(actionElements.findPrevious, 'keyup', (e) => { addDomListener(actionElements.findPrevious, 'keyup', (e) => {
const searchOptions = getSearchOptions(); searchAddon.findPrevious(actionElements.findPrevious.value, getSearchOptions(e));
searchOptions.incremental = e.key !== `Enter`;
searchAddon.findPrevious(actionElements.findPrevious.value, searchOptions);
}); });
// fit is called within a setTimeout, cols and rows need this. // fit is called within a setTimeout, cols and rows need this.