Skip to content

Commit

Permalink
Merge 35db216 into 00c1211
Browse files Browse the repository at this point in the history
  • Loading branch information
skprabhanjan authored Oct 20, 2018
2 parents 00c1211 + 35db216 commit 27c4f6d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/addons/search/SearchHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ export class SearchHelper implements ISearchHelper {
let startRow = this._terminal._core.buffer.ydisp;
if (this._terminal._core.selectionManager.selectionEnd) {
// Start from the selection end if there is a selection
startRow = this._terminal._core.selectionManager.selectionEnd[1];
if (this._terminal.getSelection().length !== 0) {
startRow = this._terminal._core.selectionManager.selectionEnd[1];
}
}

// Search from ydisp + 1 to end
Expand Down Expand Up @@ -75,7 +77,9 @@ export class SearchHelper implements ISearchHelper {
let startRow = this._terminal._core.buffer.ydisp;
if (this._terminal._core.selectionManager.selectionStart) {
// Start from the selection end if there is a selection
startRow = this._terminal._core.selectionManager.selectionStart[1];
if (this._terminal.getSelection().length !== 0) {
startRow = this._terminal._core.selectionManager.selectionStart[1];
}
}

// Search from ydisp + 1 to end
Expand Down Expand Up @@ -108,7 +112,7 @@ export class SearchHelper implements ISearchHelper {
*/
private _isWholeWord(searchIndex: number, line: string, term: string): boolean {
return (((searchIndex === 0) || (nonWordCharacters.indexOf(line[searchIndex - 1]) !== -1)) &&
(((searchIndex + term.length) === line.length) || (nonWordCharacters.indexOf(line[searchIndex + term.length]) !== -1)));
(((searchIndex + term.length) === line.length) || (nonWordCharacters.indexOf(line[searchIndex + term.length]) !== -1)));
}

/**
Expand Down

0 comments on commit 27c4f6d

Please sign in to comment.