From c4abac4ba1ef0692325a736f1123a511965368a6 Mon Sep 17 00:00:00 2001 From: ItsLJcool Date: Wed, 11 Dec 2024 02:26:58 -0700 Subject: [PATCH] Fixed pasting, and added copying in `UITextBox` (#486) KeyModifier somehow returned an int outside of the KeyModifier's range :sob: Apparently there is a boolean that just checks for you called `ctrlKey`......... --- source/funkin/editors/ui/UITextBox.hx | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/source/funkin/editors/ui/UITextBox.hx b/source/funkin/editors/ui/UITextBox.hx index 3aa97fd2..b12c1770 100644 --- a/source/funkin/editors/ui/UITextBox.hx +++ b/source/funkin/editors/ui/UITextBox.hx @@ -119,12 +119,21 @@ class UITextBox extends UISliceSprite implements IUIFocusable { case END: position = label.text.length; case V: - if (modifier == KeyModifier.LEFT_CTRL || modifier == KeyModifier.RIGHT_CTRL) { - // paste - var data:String = Clipboard.generalClipboard.getData(TEXT_FORMAT); - if (data != null) - onTextInput(data); - } + // Hey lj here, fixed copying because before we checked if the modifier was left or right ctrl + // but somehow it gave a int outside of the KeyModifier's range :sob: + // apparently there is a boolean that just checks for you. yw :D + + // if we are not holding ctrl, ignore + if (!modifier.ctrlKey) return; + // we pasting + var data:String = Clipboard.generalClipboard.getData(TEXT_FORMAT); + if (data != null) onTextInput(data); + case C: + // if we are not holding ctrl, ignore + if (!modifier.ctrlKey) return; + + // copying + Clipboard.generalClipboard.setData(TEXT_FORMAT, label.text); default: // nothing }