aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-08-05 12:23:25 -0400
committerMichael <[email protected]>2017-08-05 12:23:25 -0400
commit01683f1fcb8a593af66b0a882db7b3a2beba9fa0 (patch)
tree637f040e71acee52699b50a9fa9ffeaa95b7db5c
parentcc42d102007cfd9fc4c7663b27f545fb10dccce4 (diff)
downloadshiftos_thereturn-01683f1fcb8a593af66b0a882db7b3a2beba9fa0.tar.gz
shiftos_thereturn-01683f1fcb8a593af66b0a882db7b3a2beba9fa0.tar.bz2
shiftos_thereturn-01683f1fcb8a593af66b0a882db7b3a2beba9fa0.zip
Fix bug with backspace in TextInput
-rw-r--r--ShiftOS.Frontend/GUI/TextInput.cs23
1 files changed, 13 insertions, 10 deletions
diff --git a/ShiftOS.Frontend/GUI/TextInput.cs b/ShiftOS.Frontend/GUI/TextInput.cs
index 381541b..36e21b1 100644
--- a/ShiftOS.Frontend/GUI/TextInput.cs
+++ b/ShiftOS.Frontend/GUI/TextInput.cs
@@ -78,14 +78,6 @@ namespace ShiftOS.Frontend.GUI
_index--;
}
- if(e.Key == Microsoft.Xna.Framework.Input.Keys.Back)
- {
- if(_index > 0)
- {
- _text = _text.Remove(_index - 1, 1);
- _index--;
- }
- }
if(e.Key == Microsoft.Xna.Framework.Input.Keys.Delete)
{
if(_index < _text.Length - 1)
@@ -97,8 +89,19 @@ namespace ShiftOS.Frontend.GUI
if (_index < _text.Length)
_index++;
if (e.KeyChar != '\0') {
- _text = _text.Insert(_index, e.KeyChar.ToString());
- _index++;
+ if (e.KeyChar == '\b')
+ {
+ if (_index > 0)
+ {
+ _text = _text.Remove(_index - 1, 1);
+ _index--;
+ }
+ }
+ else
+ {
+ _text = _text.Insert(_index, e.KeyChar.ToString());
+ _index++;
+ }
}
caretMS = 0;
CalculateVisibleText();