- last minute playername editing bugfixes for pressing backspace
This commit is contained in:
parent
e594ba07de
commit
1c32515d7a
|
@ -1182,13 +1182,16 @@ bool MenuStateConnectedGame::hasNetworkGameSettings()
|
|||
|
||||
void MenuStateConnectedGame::keyDown(char key) {
|
||||
if(activeInputLabel != NULL) {
|
||||
if(key == vkBack) {
|
||||
string text = activeInputLabel->getText();
|
||||
if(key == vkBack && text.length() > 0) {
|
||||
size_t found = text.find_last_of("_");
|
||||
if (found == string::npos) {
|
||||
text.erase(text.end() - 1);
|
||||
}
|
||||
else {
|
||||
if(text.size() > 1) {
|
||||
text.erase(text.end() - 2);
|
||||
}
|
||||
if(text.size() == 1) {
|
||||
text.erase(text.end() - 1);
|
||||
}
|
||||
|
||||
activeInputLabel->setText(text);
|
||||
|
|
|
@ -2268,13 +2268,16 @@ void MenuStateCustomGame::updateNetworkSlots() {
|
|||
|
||||
void MenuStateCustomGame::keyDown(char key) {
|
||||
if(activeInputLabel != NULL) {
|
||||
if(key == vkBack) {
|
||||
string text = activeInputLabel->getText();
|
||||
if(key == vkBack && text.length() > 0) {
|
||||
size_t found = text.find_last_of("_");
|
||||
if (found == string::npos) {
|
||||
text.erase(text.end() - 1);
|
||||
}
|
||||
else {
|
||||
if(text.size() > 1) {
|
||||
text.erase(text.end() - 2);
|
||||
}
|
||||
if(text.size() == 1) {
|
||||
text.erase(text.end() - 1);
|
||||
}
|
||||
|
||||
activeInputLabel->setText(text);
|
||||
|
|
Loading…
Reference in New Issue
Block a user