mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
change return value, import ISelectionPosition
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user