5 import { SearchHelper } from './SearchHelper';
7 declare var exports: any;
8 declare var module: any;
9 declare var define: any;
10 declare var require: any;
11 declare var window: any;
14 if ('Terminal' in window) {
16 * Plain browser environment
18 addon(window.Terminal);
19 } else if (typeof exports === 'object' && typeof module === 'object') {
21 * CommonJS environment
23 const xterm = '../../xterm';
24 module.exports = addon(require(xterm));
25 } else if (typeof define == 'function') {
27 * Require.js is available
29 define(['../../xterm'], addon);
31 })((Terminal: any) => {
33 * Find the next instance of the term, then scroll to and select it. If it
34 * doesn't exist, do nothing.
35 * @param term Tne search term.
36 * @return Whether a result was found.
38 Terminal.prototype.findNext = function(term: string): boolean {
39 if (!this._searchHelper) {
40 this.searchHelper = new SearchHelper(this, Terminal.translateBufferLineToString);
42 return (<SearchHelper>this.searchHelper).findNext(term);
46 * Find the previous instance of the term, then scroll to and select it. If it
47 * doesn't exist, do nothing.
48 * @param term Tne search term.
49 * @return Whether a result was found.
51 Terminal.prototype.findPrevious = function(term: string): boolean {
52 if (!this._searchHelper) {
53 this.searchHelper = new SearchHelper(this, Terminal.translateBufferLineToString);
55 return (<SearchHelper>this.searchHelper).findPrevious(term);