mirror of
https://github.com/neoStudiosLCE/neoLegacy.git
synced 2026-08-20 09:57:09 +00:00
Add Ctrl+V clipboard paste to UIControl_TextInput and UIScene_Keyboard
Previously paste only worked in the chat screen. Wire Screen::getClipboard() into the two remaining text input paths so Ctrl+V works for sign editing, seed entry, server IP/port, and world name fields.
This commit is contained in:
parent
289f1ccd6a
commit
3980cd813a
|
|
@ -1,6 +1,7 @@
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "UI.h"
|
#include "UI.h"
|
||||||
#include "UIControl_TextInput.h"
|
#include "UIControl_TextInput.h"
|
||||||
|
#include "..\..\Screen.h"
|
||||||
|
|
||||||
UIControl_TextInput::UIControl_TextInput()
|
UIControl_TextInput::UIControl_TextInput()
|
||||||
{
|
{
|
||||||
|
|
@ -211,6 +212,21 @@ UIControl_TextInput::EDirectEditResult UIControl_TextInput::tickDirectEdit()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Paste from clipboard
|
||||||
|
if (g_KBMInput.IsKeyPressed('V') && g_KBMInput.IsKeyDown(VK_CONTROL))
|
||||||
|
{
|
||||||
|
wstring pasted = Screen::getClipboard();
|
||||||
|
for (size_t i = 0; i < pasted.length(); i++)
|
||||||
|
{
|
||||||
|
wchar_t pc = pasted[i];
|
||||||
|
if (pc < 0x20) continue; // skip control characters
|
||||||
|
if (m_iCharLimit > 0 && (int)m_editBuffer.length() >= m_iCharLimit) break;
|
||||||
|
m_editBuffer.insert(m_iCursorPos, 1, pc);
|
||||||
|
m_iCursorPos++;
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Arrow keys, Home, End, Delete for cursor movement
|
// Arrow keys, Home, End, Delete for cursor movement
|
||||||
if (g_KBMInput.IsKeyPressed(VK_LEFT) && m_iCursorPos > 0)
|
if (g_KBMInput.IsKeyPressed(VK_LEFT) && m_iCursorPos > 0)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "UI.h"
|
#include "UI.h"
|
||||||
#include "UIScene_Keyboard.h"
|
#include "UIScene_Keyboard.h"
|
||||||
|
#include "..\..\Screen.h"
|
||||||
|
|
||||||
#ifdef _WINDOWS64
|
#ifdef _WINDOWS64
|
||||||
// Global buffer that stores the text entered in the native keyboard scene.
|
// Global buffer that stores the text entered in the native keyboard scene.
|
||||||
|
|
@ -224,6 +225,28 @@ void UIScene_Keyboard::tick()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Paste from clipboard
|
||||||
|
if (g_KBMInput.IsKeyPressed('V') && g_KBMInput.IsKeyDown(VK_CONTROL))
|
||||||
|
{
|
||||||
|
wstring pasted = Screen::getClipboard();
|
||||||
|
for (size_t i = 0; i < pasted.length(); i++)
|
||||||
|
{
|
||||||
|
wchar_t pc = pasted[i];
|
||||||
|
if (pc < 0x20) continue; // skip control characters
|
||||||
|
if (static_cast<int>(m_win64TextBuffer.length()) >= m_win64MaxChars) break;
|
||||||
|
if (m_bPCMode)
|
||||||
|
{
|
||||||
|
m_win64TextBuffer.insert(m_iCursorPos, 1, pc);
|
||||||
|
m_iCursorPos++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_win64TextBuffer += pc;
|
||||||
|
}
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (m_bPCMode)
|
if (m_bPCMode)
|
||||||
{
|
{
|
||||||
// Arrow keys, Home, End, Delete for cursor movement
|
// Arrow keys, Home, End, Delete for cursor movement
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue