mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
jsdoc
This commit is contained in:
@@ -32,7 +32,7 @@ declare var window: any;
|
||||
/**
|
||||
* Find the next instance of the term, then scroll to and select it. If it
|
||||
* doesn't exist, do nothing.
|
||||
* @param term The term to search for.
|
||||
* @param term Tne search term.
|
||||
* @return Whether a result was found.
|
||||
*/
|
||||
Terminal.prototype.findNext = function(term: string): boolean {
|
||||
@@ -45,7 +45,7 @@ declare var window: any;
|
||||
/**
|
||||
* Find the previous instance of the term, then scroll to and select it. If it
|
||||
* doesn't exist, do nothing.
|
||||
* @param term The term to search for.
|
||||
* @param term Tne search term.
|
||||
* @return Whether a result was found.
|
||||
*/
|
||||
Terminal.prototype.findPrevious = function(term: string): boolean {
|
||||
|
||||
@@ -11,6 +11,9 @@ interface ISearchResult {
|
||||
row: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
// TODO: Search for multiple instances on 1 line
|
||||
@@ -22,7 +25,7 @@ export class SearchHelper {
|
||||
/**
|
||||
* Find the next instance of the term, then scroll to and select it. If it
|
||||
* doesn't exist, do nothing.
|
||||
* @param term The term to search for.
|
||||
* @param term Tne search term.
|
||||
* @return Whether a result was found.
|
||||
*/
|
||||
public findNext(term: string): boolean {
|
||||
@@ -63,7 +66,7 @@ export class SearchHelper {
|
||||
/**
|
||||
* Find the previous instance of the term, then scroll to and select it. If it
|
||||
* doesn't exist, do nothing.
|
||||
* @param term The term to search for.
|
||||
* @param term Tne search term.
|
||||
* @return Whether a result was found.
|
||||
*/
|
||||
public findPrevious(term: string): boolean {
|
||||
@@ -101,6 +104,12 @@ export class SearchHelper {
|
||||
return this._selectResult(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Searches a line for a search term.
|
||||
* @param term Tne search term.
|
||||
* @param y The line to search.
|
||||
* @return The search result if it was found.
|
||||
*/
|
||||
private _findInLine(term: string, y: number): ISearchResult {
|
||||
const bufferLine = this._terminal.lines.get(y);
|
||||
const lowerStringLine = this._translateBufferLineToString(bufferLine, true).toLowerCase();
|
||||
@@ -115,6 +124,11 @@ export class SearchHelper {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Selects and scrolls to a result.
|
||||
* @param result The result to select.
|
||||
* @return Whethera result was selected.
|
||||
*/
|
||||
private _selectResult(result: ISearchResult): boolean {
|
||||
if (!result) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user