@@ -20,7 +20,7 @@ import { TerminalConfigHelper } from 'vs/workbench/contrib/terminal/browser/term
20
20
import { writeP } from 'vs/workbench/contrib/terminal/browser/terminalTestHelpers' ;
21
21
import { XtermTerminal } from 'vs/workbench/contrib/terminal/browser/xterm/xtermTerminal' ;
22
22
import { ITerminalConfiguration } from 'vs/workbench/contrib/terminal/common/terminal' ;
23
- import { BufferContentTracker , replaceWithNonBreakingSpaces } from 'vs/workbench/contrib/terminalContrib/accessibility/browser/bufferContentTracker' ;
23
+ import { BufferContentTracker } from 'vs/workbench/contrib/terminalContrib/accessibility/browser/bufferContentTracker' ;
24
24
import { ILifecycleService } from 'vs/workbench/services/lifecycle/common/lifecycle' ;
25
25
import { TestLifecycleService } from 'vs/workbench/test/browser/workbenchTestServices' ;
26
26
import { Terminal } from 'xterm' ;
@@ -72,22 +72,18 @@ suite('Buffer Content Tracker', () => {
72
72
assert . strictEqual ( bufferTracker . lines . length , 0 ) ;
73
73
await writeP ( xterm . raw , prompt ) ;
74
74
xterm . clearBuffer ( ) ;
75
- await bufferTracker . update ( ) ;
75
+ bufferTracker . update ( ) ;
76
76
assert . deepStrictEqual ( bufferTracker . lines , [ prompt ] ) ;
77
- assert . strictEqual ( bufferTracker . lines . length , 1 ) ;
78
77
} ) ;
79
78
test ( 'repeated updates should not change the content' , async ( ) => {
80
79
assert . strictEqual ( bufferTracker . lines . length , 0 ) ;
81
80
await writeP ( xterm . raw , prompt ) ;
82
- await bufferTracker . update ( ) ;
81
+ bufferTracker . update ( ) ;
83
82
assert . deepStrictEqual ( bufferTracker . lines , [ prompt ] ) ;
84
- assert . strictEqual ( bufferTracker . lines . length , 1 ) ;
85
- await bufferTracker . update ( ) ;
83
+ bufferTracker . update ( ) ;
86
84
assert . deepStrictEqual ( bufferTracker . lines , [ prompt ] ) ;
87
- assert . strictEqual ( bufferTracker . lines . length , 1 ) ;
88
- await bufferTracker . update ( ) ;
85
+ bufferTracker . update ( ) ;
89
86
assert . deepStrictEqual ( bufferTracker . lines , [ prompt ] ) ;
90
- assert . strictEqual ( bufferTracker . lines . length , 1 ) ;
91
87
} ) ;
92
88
test ( 'should add lines in the viewport and scrollback' , async ( ) => {
93
89
await writeAndAssertBufferState ( promptPlusData , 38 , xterm . raw , bufferTracker ) ;
@@ -98,31 +94,31 @@ suite('Buffer Content Tracker', () => {
98
94
test ( 'should refresh viewport' , async ( ) => {
99
95
await writeAndAssertBufferState ( promptPlusData , 6 , xterm . raw , bufferTracker ) ;
100
96
await writeP ( xterm . raw , '\x1b[3Ainserteddata' ) ;
101
- await bufferTracker . update ( ) ;
102
- assert . deepStrictEqual ( bufferTracker . lines , [ promptPlusData , promptPlusData , `${ promptPlusData } inserteddata` , promptPlusData , promptPlusData , promptPlusData ] . map ( s => replaceWithNonBreakingSpaces ( s ) ) ) ;
97
+ bufferTracker . update ( ) ;
98
+ assert . deepStrictEqual ( bufferTracker . lines , [ promptPlusData , promptPlusData , `${ promptPlusData } inserteddata` , promptPlusData , promptPlusData , promptPlusData ] ) ;
103
99
} ) ;
104
100
test ( 'should refresh viewport with full scrollback' , async ( ) => {
105
- const content = replaceWithNonBreakingSpaces ( `${ prompt } \r\n` . repeat ( 1030 ) . trimEnd ( ) ) ;
101
+ const content = `${ prompt } \r\n` . repeat ( 1030 ) . trimEnd ( ) ;
106
102
await writeP ( xterm . raw , content ) ;
107
- await bufferTracker . update ( ) ;
103
+ bufferTracker . update ( ) ;
108
104
await writeP ( xterm . raw , '\x1b[4Ainsertion' ) ;
109
- await bufferTracker . update ( ) ;
105
+ bufferTracker . update ( ) ;
110
106
const expected = content . split ( '\r\n' ) ;
111
107
expected [ 1025 ] = `${ prompt } insertion` ;
112
108
assert . deepStrictEqual ( bufferTracker . lines [ 1025 ] , `${ prompt } insertion` ) ;
113
109
} ) ;
114
110
test ( 'should cap the size of the cached lines, removing old lines in favor of new lines' , async ( ) => {
115
111
const content = `${ prompt } \r\n` . repeat ( 1036 ) . trimEnd ( ) ;
116
112
await writeP ( xterm . raw , content ) ;
117
- await bufferTracker . update ( ) ;
118
- const expected = content . split ( '\r\n' ) . map ( s => replaceWithNonBreakingSpaces ( s ) ) ;
113
+ bufferTracker . update ( ) ;
114
+ const expected = content . split ( '\r\n' ) ;
119
115
// delete the 6 lines that should be trimmed
120
116
for ( let i = 0 ; i < 6 ; i ++ ) {
121
117
expected . pop ( ) ;
122
118
}
123
119
// insert a new character
124
120
await writeP ( xterm . raw , '\x1b[2Ainsertion' ) ;
125
- await bufferTracker . update ( ) ;
121
+ bufferTracker . update ( ) ;
126
122
expected [ 1027 ] = `${ prompt } insertion` ;
127
123
assert . strictEqual ( bufferTracker . lines . length , expected . length ) ;
128
124
assert . deepStrictEqual ( bufferTracker . lines , expected ) ;
@@ -132,8 +128,8 @@ suite('Buffer Content Tracker', () => {
132
128
async function writeAndAssertBufferState ( data : string , rows : number , terminal : Terminal , bufferTracker : BufferContentTracker ) : Promise < void > {
133
129
const content = `${ data } \r\n` . repeat ( rows ) . trimEnd ( ) ;
134
130
await writeP ( terminal , content ) ;
135
- await bufferTracker . update ( ) ;
131
+ bufferTracker . update ( ) ;
136
132
assert . strictEqual ( bufferTracker . lines . length , rows ) ;
137
- assert . deepStrictEqual ( bufferTracker . lines , content . split ( '\r\n' ) . map ( s => replaceWithNonBreakingSpaces ( s ) ) ) ;
133
+ assert . deepStrictEqual ( bufferTracker . lines , content . split ( '\r\n' ) ) ;
138
134
}
139
135
0 commit comments