diff --git a/src/addons/search/SearchHelper.ts b/src/addons/search/SearchHelper.ts index 43d6dc185..26e4e8a7d 100644 --- a/src/addons/search/SearchHelper.ts +++ b/src/addons/search/SearchHelper.ts @@ -15,7 +15,7 @@ interface ISearchResult { * A class that knows how to search the terminal and how to display the results. */ export class SearchHelper { - constructor(private _terminal: any, private _translateBufferLineToString: any) { + constructor(private _terminal: any) { // TODO: Search for multiple instances on 1 line // TODO: Don't use the actual selection, instead use a "find selection" so multiple instances can be highlighted // TODO: Highlight other instances in the viewport @@ -111,8 +111,7 @@ export class SearchHelper { * @return The search result if it was found. */ private _findInLine(term: string, y: number): ISearchResult { - const bufferLine = this._terminal.buffer.lines.get(y); - const lowerStringLine = this._translateBufferLineToString(bufferLine, true).toLowerCase(); + const lowerStringLine = this._terminal.buffer.translateBufferLineToString(y, true).toLowerCase(); const lowerTerm = term.toLowerCase(); const searchIndex = lowerStringLine.indexOf(lowerTerm); if (searchIndex >= 0) { diff --git a/src/addons/search/search.ts b/src/addons/search/search.ts index 879ca4ee0..34223c4ea 100644 --- a/src/addons/search/search.ts +++ b/src/addons/search/search.ts @@ -36,7 +36,7 @@ declare var window: any; */ Terminal.prototype.findNext = function(term: string): boolean { if (!this._searchHelper) { - this.searchHelper = new SearchHelper(this, Terminal.translateBufferLineToString); + this.searchHelper = new SearchHelper(this); } return (this.searchHelper).findNext(term); }; @@ -49,7 +49,7 @@ declare var window: any; */ Terminal.prototype.findPrevious = function(term: string): boolean { if (!this._searchHelper) { - this.searchHelper = new SearchHelper(this, Terminal.translateBufferLineToString); + this.searchHelper = new SearchHelper(this); } return (this.searchHelper).findPrevious(term); };