Use Terminal type in attach, fit and fullscreen

This commit is contained in:
Daniel Imms
2018-01-19 09:30:24 -08:00
parent 682eb2f861
commit ec17fb9179
9 changed files with 94 additions and 67 deletions
+1 -1
View File
@@ -6,7 +6,7 @@
import { Terminal } from 'xterm';
export interface ISearchAddonTerminal extends Terminal {
__searchHelper: ISearchHelper;
__searchHelper?: ISearchHelper;
// TODO: Reuse ITerminal from core
buffer: any;
+5 -5
View File
@@ -16,7 +16,7 @@ import { ISearchAddonTerminal } from './Interfaces';
* @return Whether a result was found.
*/
export function findNext(terminal: Terminal, term: string): boolean {
const addonTerminal = (<ISearchAddonTerminal>terminal);
const addonTerminal = <ISearchAddonTerminal>terminal;
if (!addonTerminal.__searchHelper) {
addonTerminal.__searchHelper = new SearchHelper(addonTerminal);
}
@@ -30,19 +30,19 @@ export function findNext(terminal: Terminal, term: string): boolean {
* @return Whether a result was found.
*/
export function findPrevious(terminal: Terminal, term: string): boolean {
const addonTerminal = (<ISearchAddonTerminal>terminal);
const addonTerminal = <ISearchAddonTerminal>terminal;
if (!addonTerminal.__searchHelper) {
addonTerminal.__searchHelper = new SearchHelper(addonTerminal);
}
return addonTerminal.__searchHelper.findPrevious(term);
}
export function apply(terminalConstructor: any): void {
terminalConstructor.prototype.findNext = function(term: string): boolean {
export function apply(terminalConstructor: typeof Terminal): void {
(<any>terminalConstructor.prototype).findNext = function(term: string): boolean {
return findNext(this, term);
};
terminalConstructor.prototype.findPrevious = function(term: string): boolean {
(<any>terminalConstructor.prototype).findPrevious = function(term: string): boolean {
return findPrevious(this, term);
};
}