Added test and fixed uncovered buy

This commit is contained in:
Alex Ross
2018-09-11 16:29:11 -07:00
parent 8979eea810
commit 5aa6656971
2 changed files with 6 additions and 3 deletions
+1 -1
View File
@@ -170,7 +170,7 @@ export class SearchHelper implements ISearchHelper {
let lineWrapsToNext: boolean; let lineWrapsToNext: boolean;
do { do {
const nextLine = this._terminal._core.buffer.lines.get(lineIndex); const nextLine = this._terminal._core.buffer.lines.get(lineIndex + 1);
lineWrapsToNext = nextLine ? nextLine.isWrapped : false; lineWrapsToNext = nextLine ? nextLine.isWrapped : false;
lineString += this._terminal._core.buffer.translateBufferLineToString(lineIndex, !lineWrapsToNext && trimRight); lineString += this._terminal._core.buffer.translateBufferLineToString(lineIndex, !lineWrapsToNext && trimRight);
lineIndex++; lineIndex++;
+5 -2
View File
@@ -59,14 +59,15 @@ describe('search addon', () => {
search.apply(<any>MockTerminal); search.apply(<any>MockTerminal);
const term = new MockTerminal({cols: 10, rows: 5}); const term = new MockTerminal({cols: 10, rows: 5});
term.core.write('texttextHellotext\r\n'); term.core.write('texttextHellotext\r\n');
term.core.write('texttexttextHellotext'); term.core.write('texttexttextHellotext goodbye');
term.pushWriteData(); term.pushWriteData();
/* /*
texttextHe texttextHe
llotext llotext
texttextte texttextte
xtHellotex xtHellotex
t t (these spaces included intentionally)
goodbye
*/ */
const hello0 = (term.searchHelper as any)._findInLine('Hello', 0); const hello0 = (term.searchHelper as any)._findInLine('Hello', 0);
@@ -74,11 +75,13 @@ describe('search addon', () => {
const hello2 = (term.searchHelper as any)._findInLine('Hello', 2); const hello2 = (term.searchHelper as any)._findInLine('Hello', 2);
const hello3 = (term.searchHelper as any)._findInLine('Hello', 3); const hello3 = (term.searchHelper as any)._findInLine('Hello', 3);
const llo = (term.searchHelper as any)._findInLine('llo', 1); const llo = (term.searchHelper as any)._findInLine('llo', 1);
const goodbye = (term.searchHelper as any)._findInLine('goodbye', 2);
expect(hello0).eql({col: 8, row: 0, term: 'Hello'}); expect(hello0).eql({col: 8, row: 0, term: 'Hello'});
expect(hello1).eql(undefined); expect(hello1).eql(undefined);
expect(hello2).eql({col: 2, row: 3, term: 'Hello'}); expect(hello2).eql({col: 2, row: 3, term: 'Hello'});
expect(hello3).eql(undefined); expect(hello3).eql(undefined);
expect(llo).eql(undefined); expect(llo).eql(undefined);
expect(goodbye).eql({col: 0, row: 5, term: 'goodbye'});
}); });
it('should respect search regex', () => { it('should respect search regex', () => {
search.apply(<any>MockTerminal); search.apply(<any>MockTerminal);