Copy all text in Label, Textbox, etc. if none is selected (fixes #720)

This is more in line with what Cut does in Textboxes when nothing is selected.
This commit is contained in:
Tamás Bálint Misius 2020-10-11 21:13:13 +02:00
parent a0a0e6c498
commit 18dfd6de86
No known key found for this signature in database
GPG Key ID: 5B472A12F6ECA9F2
2 changed files with 4 additions and 19 deletions

View File

@ -113,6 +113,10 @@ void Label::copySelection()
{
ClipboardPush(format::CleanString(text.Between(selectionIndexL.raw_index, selectionIndexH.raw_index), false, true, false).ToUtf8());
}
else
{
ClipboardPush(format::CleanString(text, false, true, false).ToUtf8());
}
}
void Label::OnMouseUp(int x, int y, unsigned button)

View File

@ -503,25 +503,6 @@ void Textbox::OnTextInput(String text)
void Textbox::OnMouseClick(int x, int y, unsigned button)
{
if (button == SDL_BUTTON_RIGHT)
{
if (HasSelection())
{
menu->RemoveItem(0);
menu->RemoveItem(1);
menu->RemoveItem(2);
menu->AddItem(ContextMenuItem("Cut", 1, true));
menu->AddItem(ContextMenuItem("Copy", 0, true));
menu->AddItem(ContextMenuItem("Paste", 2, true));
}
else
{
menu->RemoveItem(0);
menu->RemoveItem(1);
menu->RemoveItem(2);
menu->AddItem(ContextMenuItem("Paste", 2, true));
}
}
if (button != SDL_BUTTON_RIGHT)
{
mouseDown = true;