terminal
terminal copied to clipboard
`sendInput` should be previewable
See #9818, 60f63b09cc59f1a46d142952f49dbf7599bc4cf8, #3121. I literally have this prototyped, just need to check it in. It's important for future issues...
More cleanly pulled to its own branch: https://github.com/microsoft/terminal/pull/new/dev/migrie/f/12861-preview-input
Note: You'll also want the backspace trimming thing. That merged into TSFControl in 0f32692 but I don't know where its origin was before that.
void TSFInputControl::ManuallyDisplayText(const winrt::hstring& text)
{
_focused = !text.empty();
Canvas().Visibility(text.empty() ? Visibility::Collapsed : Visibility::Visible);
_inputBuffer.clear();
// _editContext.NotifyFocusLeave();
_activeTextStart = 0;
_inComposition = false;
// HACK trim off leading DEL chars.
std::wstring_view view{ text.c_str() };
const auto strBegin = view.find_first_not_of(L"\x7f");
if (strBegin != std::wstring::npos)
{
view = view.substr(strBegin * 2);
}
TextBlock().Text(winrt::hstring{ view });
TextBlock().UpdateLayout();
TryRedrawCanvas();
}
Curious how this will handle sendInputd escape sequences!
Protip, revert 7c3fd2aeecf57d0320ff915d7c8c68e10acb1763
I backed it out because it:
- worked wacky with wide glyphs / unicode surrogates and the backspacing code
- the backspacing code was hacky kinda always
- it didn't always scale and offset to the correct position
- didn't really handle line wrapping well
- with the pwsh ghost text, was very confusing
you may also need 8f0b6f8a2
Punting out of 1.19. This was wacky as-is. We may want to come back to re-try this with more runway.