mirror of
https://git.proxmox.com/git/mirror_xterm.js
synced 2025-11-03 05:09:51 +00:00
Expose API on Terminal
This commit is contained in:
parent
7d8f698096
commit
f88dcd160c
@ -22,7 +22,7 @@ export class SearchHelper {
|
||||
*/
|
||||
public findNext(term: string): boolean {
|
||||
if (!term || term.length === 0) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
let result: ISearchResult;
|
||||
@ -63,7 +63,7 @@ export class SearchHelper {
|
||||
*/
|
||||
public findPrevious(term: string): boolean {
|
||||
if (!term || term.length === 0) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
let result: ISearchResult;
|
||||
@ -111,10 +111,11 @@ export class SearchHelper {
|
||||
|
||||
private _selectResult(result: ISearchResult): boolean {
|
||||
if (!result) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
this._terminal.selectionManager.setSelection(result.col, result.row, result.term.length);
|
||||
this._terminal.scrollDisp(result.row - this._terminal.ydisp, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
// TODO: Consolidate with SelectionManager function
|
||||
|
||||
20
src/xterm.js
20
src/xterm.js
@ -1405,6 +1405,26 @@ Terminal.prototype.selectAll = function() {
|
||||
this.selectionManager.selectAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* @return Whether a result was found.
|
||||
*/
|
||||
Terminal.prototype.findNext = function(term) {
|
||||
return this.searchHelper.findNext(term);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* @return Whether a result was found.
|
||||
*/
|
||||
Terminal.prototype.findPrevious = function(term) {
|
||||
return this.searchHelper.findPrevious(term);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle a keydown event
|
||||
* Key Resources:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user