diff options
Diffstat (limited to 'Minecraft.Client/Common/UI/UIScene_Keyboard.cpp')
| -rw-r--r-- | Minecraft.Client/Common/UI/UIScene_Keyboard.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/Minecraft.Client/Common/UI/UIScene_Keyboard.cpp b/Minecraft.Client/Common/UI/UIScene_Keyboard.cpp index 2f2f9132..35edf17f 100644 --- a/Minecraft.Client/Common/UI/UIScene_Keyboard.cpp +++ b/Minecraft.Client/Common/UI/UIScene_Keyboard.cpp @@ -1,6 +1,7 @@ #include "stdafx.h" #include "UI.h" #include "UIScene_Keyboard.h" +#include "..\..\Screen.h" #ifdef _WINDOWS64 // Global buffer that stores the text entered in the native keyboard scene. @@ -224,6 +225,38 @@ void UIScene_Keyboard::tick() } } + // Paste from clipboard + if (g_KBMInput.IsKeyPressed('V') && g_KBMInput.IsKeyDown(VK_CONTROL)) + { + wstring pasted = Screen::getClipboard(); + wstring sanitized; + sanitized.reserve(pasted.length()); + + for (wchar_t pc : pasted) + { + if (pc >= 0x20) // Keep printable characters + { + if (static_cast<int>(m_win64TextBuffer.length() + sanitized.length()) >= m_win64MaxChars) + break; + sanitized += pc; + } + } + + if (!sanitized.empty()) + { + if (m_bPCMode) + { + m_win64TextBuffer.insert(m_iCursorPos, sanitized); + m_iCursorPos += (int)sanitized.length(); + } + else + { + m_win64TextBuffer += sanitized; + } + changed = true; + } + } + if (m_bPCMode) { // Arrow keys, Home, End, Delete for cursor movement |
