@@ -94,9 +94,15 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
9494 // - helper that will write an unterminated string (generally, from a resource) to the output stream.
9595 // Arguments:
9696 // - str: the string to write.
97+ void AzureConnection::_WriteStringWithNewline (std::wstring str)
98+ {
99+ str.append (L" \r\n " );
100+ TerminalOutput.raise (winrt_wstring_to_array_view (str));
101+ }
102+
97103 void AzureConnection::_WriteStringWithNewline (const std::wstring_view str)
98104 {
99- TerminalOutput.raise (str + L" \r\n " );
105+ TerminalOutput.raise (winrt_wstring_to_array_view ( str + L" \r\n " ) );
100106 }
101107
102108 // Method description:
@@ -112,7 +118,7 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
112118 catch (const std::exception& runtimeException)
113119 {
114120 // This also catches the AzureException, which has a .what()
115- TerminalOutput.raise (_colorize (91 , til::u8u16 (std::string{ runtimeException.what () })));
121+ TerminalOutput.raise (winrt_wstring_to_array_view ( _colorize (91 , til::u8u16 (std::string{ runtimeException.what () }) )));
116122 }
117123 catch (...)
118124 {
@@ -162,13 +168,13 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
162168
163169 _currentInputMode = mode;
164170
165- TerminalOutput.raise (L" > \x1b [92m" ); // Make prompted user input green
171+ TerminalOutput.raise (winrt_wstring_to_array_view ( L" > \x1b [92m" ) ); // Make prompted user input green
166172
167173 _inputEvent.wait (inputLock, [this , mode]() {
168174 return _currentInputMode != mode || _isStateAtOrBeyond (ConnectionState::Closing);
169175 });
170176
171- TerminalOutput.raise (L" \x1b [m" );
177+ TerminalOutput.raise (winrt_wstring_to_array_view ( L" \x1b [m" ) );
172178
173179 if (_isStateAtOrBeyond (ConnectionState::Closing))
174180 {
@@ -211,19 +217,19 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
211217 if (_userInput.size () > 0 )
212218 {
213219 _userInput.pop_back ();
214- TerminalOutput.raise (L" \x08 \x08 " ); // overstrike the character with a space
220+ TerminalOutput.raise (winrt_wstring_to_array_view ( L" \x08 \x08 " ) ); // overstrike the character with a space
215221 }
216222 }
217223 else
218224 {
219- TerminalOutput.raise (data); // echo back
225+ TerminalOutput.raise (winrt_wstring_to_array_view ( data) ); // echo back
220226
221227 switch (_currentInputMode)
222228 {
223229 case InputMode::Line:
224230 if (data.size () > 0 && gsl::at (data, 0 ) == UNICODE_CARRIAGERETURN)
225231 {
226- TerminalOutput.raise (L" \r\n " ); // we probably got a \r, so we need to advance to the next line.
232+ TerminalOutput.raise (winrt_wstring_to_array_view ( L" \r\n " ) ); // we probably got a \r, so we need to advance to the next line.
227233 _currentInputMode = InputMode::None; // toggling the mode indicates completion
228234 _inputEvent.notify_one ();
229235 break ;
@@ -429,7 +435,7 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
429435 }
430436
431437 // Pass the output to our registered event handlers
432- TerminalOutput.raise (_u16Str);
438+ TerminalOutput.raise (winrt_wstring_to_array_view ( _u16Str) );
433439 break ;
434440 }
435441 case WINHTTP_WEB_SOCKET_CLOSE_BUFFER_TYPE:
@@ -772,7 +778,7 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
772778 const auto shellType = _ParsePreferredShellType (settingsResponse);
773779 _WriteStringWithNewline (RS_ (L" AzureRequestingTerminal" ));
774780 const auto socketUri = _GetTerminal (shellType);
775- TerminalOutput.raise (L" \r\n " );
781+ TerminalOutput.raise (winrt_wstring_to_array_view ( L" \r\n " ) );
776782
777783 // // Step 8: connecting to said terminal
778784 {
0 commit comments