From 495f97cf95034f36166e3b32978ade076752e096 Mon Sep 17 00:00:00 2001 From: Miguel Roncancio Date: Mon, 21 Oct 2019 23:39:01 -0400 Subject: [PATCH] change return value, import ISelectionPosition --- addons/xterm-addon-search/src/SearchAddon.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/xterm-addon-search/src/SearchAddon.ts b/addons/xterm-addon-search/src/SearchAddon.ts index 3c12e4f1..5f85ebbf 100644 --- a/addons/xterm-addon-search/src/SearchAddon.ts +++ b/addons/xterm-addon-search/src/SearchAddon.ts @@ -3,7 +3,7 @@ * @license MIT */ -import { Terminal, IDisposable, ITerminalAddon } from 'xterm'; +import { Terminal, IDisposable, ITerminalAddon, ISelectionPosition } from 'xterm'; export interface ISearchOptions { regex?: boolean; @@ -59,7 +59,7 @@ export class SearchAddon implements ITerminalAddon { let startCol = 0; let startRow = 0; - let currentSelection = null; + let currentSelection: ISelectionPosition | undefined = undefined; if (this._terminal.hasSelection()) { const incremental = searchOptions ? searchOptions.incremental : false; // Start from the selection end if there is a selection @@ -98,7 +98,7 @@ export class SearchAddon implements ITerminalAddon { } // If there is only one result, return false. - if (!result && currentSelection) return false; + if (!result && currentSelection) return true; // Set selection and scroll if a result was found return this._selectResult(result); @@ -126,7 +126,7 @@ export class SearchAddon implements ITerminalAddon { let startCol = this._terminal.cols; let result: ISearchResult | undefined = undefined; const incremental = searchOptions ? searchOptions.incremental : false; - let currentSelection = null; + let currentSelection: ISelectionPosition | undefined = undefined; if (this._terminal.hasSelection()) { currentSelection = this._terminal.getSelectionPosition()!; // Start from selection start if there is a selection @@ -166,7 +166,7 @@ export class SearchAddon implements ITerminalAddon { } // If there is only one result, return false. - if (!result && currentSelection) return false; + if (!result && currentSelection) return true; // Set selection and scroll if a result was found return this._selectResult(result);