@@ -82,6 +82,84 @@ suite('PromptInputModel', () => {
82
82
promptInputModel . forceSync ( ) ;
83
83
assertPromptInput ( 'foo|' ) ;
84
84
} ) ;
85
+ test ( 'input with accepted and run ghost text' , async ( ) => {
86
+ await replayEvents ( [
87
+ '[?25l[2J[m[H]0;C:\Program Files\WindowsApps\Microsoft.PowerShell_7.4.2.0_x64__8wekyb3d8bbwe\pwsh.exe[?25h' ,
88
+ '[?25l[K\r\n[K\r\n[K\r\n[K\r\n[K\r\n[K\r\n[K\r\n[K\r\n[K\r\n[K\r\n[K\r\n[K\r\n[K\r\n[K\r\n[K\r\n[K\r\n[K\r\n[K\r\n[K\r\n[K\r\n[K\r\n[K\r\n[K\r\n[K\r\n[K\r\n[K[H[?25h' ,
89
+ ']633;P;IsWindows=True' ,
90
+ ']633;P;ContinuationPrompt=\x1b[38\x3b5\x3b8m∙\x1b[0m ' ,
91
+ ']633;A]633;P;Cwd=C:\x5cGithub\x5cmicrosoft\x5cvscode]633;B' ,
92
+ '[34m\r\n[38;2;17;17;17m[44m03:41:36 [34m[41m [38;2;17;17;17mvscode [31m[43m [38;2;17;17;17m tyriar/prompt_input_model [33m[46m [38;2;17;17;17m$ [36m[49m [mvia [32m[1m v18.18.2 \r\n❯[m ' ,
93
+ ] ) ;
94
+ promptInputModel . setContinuationPrompt ( '∙ ' ) ;
95
+ onCommandStart . fire ( { marker : xterm . registerMarker ( ) } as ITerminalCommand ) ;
96
+ promptInputModel . forceSync ( ) ;
97
+ assertPromptInput ( '|' ) ;
98
+
99
+ await replayEvents ( [
100
+ '[?25l[93me[97m[2m[3mcho "hello world"[3;4H[?25h' ,
101
+ '[m' ,
102
+ ] ) ;
103
+ promptInputModel . forceSync ( ) ;
104
+ assertPromptInput ( 'e|cho "hello world"' ) ;
105
+
106
+ await replayEvents ( [
107
+ '[?25l[93mec[97m[2m[3mho "hello world"[3;5H[?25h' ,
108
+ '[m' ,
109
+ ] ) ;
110
+ promptInputModel . forceSync ( ) ;
111
+ assertPromptInput ( 'ec|ho "hello world"' ) ;
112
+
113
+ await replayEvents ( [
114
+ '[?25l[93m[3;3Hech[97m[2m[3mo "hello world"[3;6H[?25h' ,
115
+ '[m' ,
116
+ ] ) ;
117
+ promptInputModel . forceSync ( ) ;
118
+ assertPromptInput ( 'ech|o "hello world"' ) ;
119
+
120
+ await replayEvents ( [
121
+ '[?25l[93m[3;3Hecho[97m[2m[3m "hello world"[3;7H[?25h' ,
122
+ '[m' ,
123
+ ] ) ;
124
+ promptInputModel . forceSync ( ) ;
125
+ assertPromptInput ( 'echo| "hello world"' ) ;
126
+
127
+ await replayEvents ( [
128
+ '[?25l[93m[3;3Hecho [97m[2m[3m"hello world"[3;8H[?25h' ,
129
+ '[m' ,
130
+ ] ) ;
131
+ promptInputModel . forceSync ( ) ;
132
+ assertPromptInput ( 'echo |"hello world"' ) ;
133
+
134
+ await replayEvents ( [
135
+ '[?25l[93m[3;3Hecho [36m"hello world"[?25h' ,
136
+ '[m' ,
137
+ ] ) ;
138
+ promptInputModel . forceSync ( ) ;
139
+ assertPromptInput ( 'echo "hello world"|' ) ;
140
+
141
+ await replayEvents ( [
142
+ ']633;E;echo "hello world";ff464d39-bc80-4bae-9ead-b1cafc4adf6f]633;C' ,
143
+ ] ) ;
144
+ onCommandExecuted . fire ( null ! ) ;
145
+ promptInputModel . forceSync ( ) ;
146
+ assertPromptInput ( 'echo "hello world"|' ) ;
147
+
148
+ await replayEvents ( [
149
+ '\r\n' ,
150
+ 'hello world\r\n' ,
151
+ ] ) ;
152
+ promptInputModel . forceSync ( ) ;
153
+ assertPromptInput ( 'echo "hello world"|' ) ;
154
+
155
+ await replayEvents ( [
156
+ ']633;D;0]633;A]633;P;Cwd=C:\x5cGithub\x5cmicrosoft\x5cvscode]633;B' ,
157
+ '[34m\r\n[38;2;17;17;17m[44m03:41:42 [34m[41m [38;2;17;17;17mvscode [31m[43m [38;2;17;17;17m tyriar/prompt_input_model [33m[46m [38;2;17;17;17m$ [36m[49m [mvia [32m[1m v18.18.2 \r\n❯[m ' ,
158
+ ] ) ;
159
+ onCommandStart . fire ( { marker : xterm . registerMarker ( ) } as ITerminalCommand ) ;
160
+ promptInputModel . forceSync ( ) ;
161
+ assertPromptInput ( '|' ) ;
162
+ } ) ;
85
163
} ) ;
86
164
} ) ;
87
165
} ) ;
0 commit comments