diff --git a/MLEM.Ui/Elements/TextField.cs b/MLEM.Ui/Elements/TextField.cs
index 559ba37..0d3ecb1 100644
--- a/MLEM.Ui/Elements/TextField.cs
+++ b/MLEM.Ui/Elements/TextField.cs
@@ -10,6 +10,7 @@ using MLEM.Input;
using MLEM.Misc;
using MLEM.Textures;
using MLEM.Ui.Style;
+using TextCopy;
namespace MLEM.Ui.Elements {
public class TextField : Element {
@@ -117,7 +118,10 @@ namespace MLEM.Ui.Elements {
// handle first initialization if not done
if (this.displayedText == null)
this.HandleTextChange(false);
-
+
+ if (!this.IsSelected || this.IsHidden)
+ return;
+
if (this.Input.IsKeyPressed(Keys.Left)) {
this.CaretPos--;
} else if (this.Input.IsKeyPressed(Keys.Right)) {
@@ -126,6 +130,13 @@ namespace MLEM.Ui.Elements {
this.CaretPos = 0;
} else if (this.Input.IsKeyPressed(Keys.End)) {
this.CaretPos = this.text.Length;
+ } else if (this.Input.IsModifierKeyDown(ModifierKey.Control)) {
+ if (this.Input.IsKeyPressed(Keys.V)) {
+ this.InsertText(Clipboard.GetText());
+ } else if (this.Input.IsKeyPressed(Keys.C)) {
+ // until there is text selection, just copy the whole content
+ Clipboard.SetText(this.Text);
+ }
}
this.caretBlinkTimer += time.ElapsedGameTime.TotalSeconds;
diff --git a/MLEM.Ui/MLEM.Ui.csproj b/MLEM.Ui/MLEM.Ui.csproj
index 4077a31..00a2f8e 100644
--- a/MLEM.Ui/MLEM.Ui.csproj
+++ b/MLEM.Ui/MLEM.Ui.csproj
@@ -17,6 +17,7 @@
all
+