mirror of
https://github.com/microsoft/terminal.git
synced 2025-12-11 13:56:33 -06:00
Avoid encoding plain text with win32-input-mode
This commit is contained in:
parent
8149bd0dd0
commit
1d25de170e
@ -65,18 +65,8 @@ bool InteractDispatch::WriteCtrlKey(const INPUT_RECORD& event)
|
|||||||
// - True.
|
// - True.
|
||||||
bool InteractDispatch::WriteString(const std::wstring_view string)
|
bool InteractDispatch::WriteString(const std::wstring_view string)
|
||||||
{
|
{
|
||||||
if (!string.empty())
|
const auto& gci = ServiceLocator::LocateGlobals().getConsoleInformation();
|
||||||
{
|
gci.GetActiveInputBuffer()->WriteString(string);
|
||||||
const auto codepage = _api.GetConsoleOutputCP();
|
|
||||||
InputEventQueue keyEvents;
|
|
||||||
|
|
||||||
for (const auto& wch : string)
|
|
||||||
{
|
|
||||||
CharToKeyEvents(wch, codepage, keyEvents);
|
|
||||||
}
|
|
||||||
|
|
||||||
WriteInput(keyEvents);
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -287,20 +287,6 @@ bool InputStateMachineEngine::ActionPrintString(const std::wstring_view string)
|
|||||||
// - true iff we successfully dispatched the sequence.
|
// - true iff we successfully dispatched the sequence.
|
||||||
bool InputStateMachineEngine::ActionPassThroughString(const std::wstring_view string, const bool /*flush*/)
|
bool InputStateMachineEngine::ActionPassThroughString(const std::wstring_view string, const bool /*flush*/)
|
||||||
{
|
{
|
||||||
if (_pDispatch->IsVtInputEnabled())
|
|
||||||
{
|
|
||||||
// Synthesize string into key events that we'll write to the buffer
|
|
||||||
// similar to TerminalInput::_SendInputSequence
|
|
||||||
if (!string.empty())
|
|
||||||
{
|
|
||||||
InputEventQueue inputEvents;
|
|
||||||
for (const auto& wch : string)
|
|
||||||
{
|
|
||||||
inputEvents.push_back(SynthesizeKeyEvent(true, 1, 0, 0, wch, 0));
|
|
||||||
}
|
|
||||||
return _pDispatch->WriteInput(inputEvents);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ActionPrintString(string);
|
return ActionPrintString(string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user