]>
Commit | Line | Data |
---|---|---|
19381454 DI |
1 | /** |
2 | * @license MIT | |
3 | */ | |
4 | ||
5 | import { SearchHelper } from './SearchHelper'; | |
6 | ||
7 | declare var exports: any; | |
8 | declare var module: any; | |
9 | declare var define: any; | |
10 | declare var require: any; | |
fab039dd | 11 | declare var window: any; |
19381454 DI |
12 | |
13 | (function (addon) { | |
14 | if ('Terminal' in window) { | |
fab039dd | 15 | /** |
19381454 DI |
16 | * Plain browser environment |
17 | */ | |
fab039dd | 18 | addon(window.Terminal); |
19381454 | 19 | } else if (typeof exports === 'object' && typeof module === 'object') { |
fab039dd | 20 | /** |
19381454 DI |
21 | * CommonJS environment |
22 | */ | |
6f749b19 | 23 | module.exports = addon(require('../../xterm')); |
fab039dd DI |
24 | } else if (typeof define == 'function') { |
25 | /** | |
26 | * Require.js is available | |
27 | */ | |
28 | define(['../../xterm'], addon); | |
19381454 DI |
29 | } |
30 | })((Terminal: any) => { | |
31 | /** | |
32 | * Find the next instance of the term, then scroll to and select it. If it | |
33 | * doesn't exist, do nothing. | |
4b0cf2ff | 34 | * @param term Tne search term. |
19381454 DI |
35 | * @return Whether a result was found. |
36 | */ | |
37 | Terminal.prototype.findNext = function(term: string): boolean { | |
38 | if (!this._searchHelper) { | |
39 | this.searchHelper = new SearchHelper(this, Terminal.translateBufferLineToString); | |
40 | } | |
41 | return (<SearchHelper>this.searchHelper).findNext(term); | |
42 | }; | |
43 | ||
44 | /** | |
45 | * Find the previous instance of the term, then scroll to and select it. If it | |
46 | * doesn't exist, do nothing. | |
4b0cf2ff | 47 | * @param term Tne search term. |
19381454 DI |
48 | * @return Whether a result was found. |
49 | */ | |
50 | Terminal.prototype.findPrevious = function(term: string): boolean { | |
51 | if (!this._searchHelper) { | |
52 | this.searchHelper = new SearchHelper(this, Terminal.translateBufferLineToString); | |
53 | } | |
54 | return (<SearchHelper>this.searchHelper).findPrevious(term); | |
55 | }; | |
56 | }); |