Skip to content

Commit c4abac4

Browse files
authored
Fixed pasting, and added copying in UITextBox (#486)
KeyModifier somehow returned an int outside of the KeyModifier's range 😭 Apparently there is a boolean that just checks for you called `ctrlKey`.........
1 parent ed56ec9 commit c4abac4

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

source/funkin/editors/ui/UITextBox.hx

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,21 @@ class UITextBox extends UISliceSprite implements IUIFocusable {
119119
case END:
120120
position = label.text.length;
121121
case V:
122-
if (modifier == KeyModifier.LEFT_CTRL || modifier == KeyModifier.RIGHT_CTRL) {
123-
// paste
124-
var data:String = Clipboard.generalClipboard.getData(TEXT_FORMAT);
125-
if (data != null)
126-
onTextInput(data);
127-
}
122+
// Hey lj here, fixed copying because before we checked if the modifier was left or right ctrl
123+
// but somehow it gave a int outside of the KeyModifier's range :sob:
124+
// apparently there is a boolean that just checks for you. yw :D
125+
126+
// if we are not holding ctrl, ignore
127+
if (!modifier.ctrlKey) return;
128+
// we pasting
129+
var data:String = Clipboard.generalClipboard.getData(TEXT_FORMAT);
130+
if (data != null) onTextInput(data);
131+
case C:
132+
// if we are not holding ctrl, ignore
133+
if (!modifier.ctrlKey) return;
134+
135+
// copying
136+
Clipboard.generalClipboard.setData(TEXT_FORMAT, label.text);
128137
default:
129138
// nothing
130139
}

0 commit comments

Comments
 (0)