5
5
6
6
import { Terminal } from 'xterm' ;
7
7
import { LineDataEventAddon } from 'vs/workbench/contrib/terminal/browser/addons/lineDataEventAddon' ;
8
+ import { OperatingSystem } from 'vs/base/common/platform' ;
8
9
import { deepStrictEqual } from 'assert' ;
9
10
10
11
async function writeP ( terminal : Terminal , data : string ) : Promise < void > {
11
12
return new Promise < void > ( r => terminal . write ( data , r ) ) ;
12
13
}
13
14
14
- suite . only ( 'XtermExtensions ', ( ) => {
15
+ suite ( 'LineDataEventAddon ', ( ) => {
15
16
let xterm : Terminal ;
16
17
let lineDataEventAddon : LineDataEventAddon ;
17
18
@@ -29,7 +30,7 @@ suite.only('XtermExtensions', () => {
29
30
lineDataEventAddon . onLineData ( e => events . push ( e ) ) ;
30
31
} ) ;
31
32
32
- test ( 'should fire when a non-wrapped line ends with a \\n ' , async ( ) => {
33
+ test ( 'should fire when a non-wrapped line ends with a line feed ' , async ( ) => {
33
34
await writeP ( xterm , 'foo' ) ;
34
35
deepStrictEqual ( events , [ ] ) ;
35
36
await writeP ( xterm , '\n\r' ) ;
@@ -49,11 +50,22 @@ suite.only('XtermExtensions', () => {
49
50
deepStrictEqual ( events , [ ] ) ;
50
51
} ) ;
51
52
52
- test ( 'should fire when a wrapped line ends with a \\n ' , async ( ) => {
53
+ test ( 'should fire when a wrapped line ends with a line feed ' , async ( ) => {
53
54
await writeP ( xterm , 'foo.bar.baz.' ) ;
54
55
deepStrictEqual ( events , [ ] ) ;
55
56
await writeP ( xterm , '\n\r' ) ;
56
57
deepStrictEqual ( events , [ 'foo.bar.baz.' ] ) ;
57
58
} ) ;
59
+
60
+ test ( 'should not fire on cursor move when the backing process is not on Windows' , async ( ) => {
61
+ await writeP ( xterm , 'foo.\x1b[H' ) ;
62
+ deepStrictEqual ( events , [ ] ) ;
63
+ } ) ;
64
+
65
+ test ( 'should fire on cursor move when the backing process is on Windows' , async ( ) => {
66
+ lineDataEventAddon . setOperatingSystem ( OperatingSystem . Windows ) ;
67
+ await writeP ( xterm , 'foo\x1b[H' ) ;
68
+ deepStrictEqual ( events , [ 'foo' ] ) ;
69
+ } ) ;
58
70
} ) ;
59
71
} ) ;
0 commit comments