[Scummvm-git-logs] scummvm master -> c03811fd221f5aeae655b7df19edb6b3dea52860

dreammaster noreply at scummvm.org
Sun Jun 4 21:17:05 UTC 2023


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
c03811fd22 MM: MM1: Fix text entry


Commit: c03811fd221f5aeae655b7df19edb6b3dea52860
    https://github.com/scummvm/scummvm/commit/c03811fd221f5aeae655b7df19edb6b3dea52860
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-06-04T14:17:00-07:00

Commit Message:
MM: MM1: Fix text entry

Changed paths:
    engines/mm/mm1/views/text_entry.cpp


diff --git a/engines/mm/mm1/views/text_entry.cpp b/engines/mm/mm1/views/text_entry.cpp
index 40f6414b33d..75ecf99e9ba 100644
--- a/engines/mm/mm1/views/text_entry.cpp
+++ b/engines/mm/mm1/views/text_entry.cpp
@@ -59,44 +59,41 @@ bool TextEntry::msgKeypress(const KeypressMessage &msg) {
 	if (msg.keycode == Common::KEYCODE_BACKSPACE &&
 			!_text.empty()) {
 		_text.deleteLastChar();
-		drawText();
-		return true;
+		redraw();
+
 	} else if (msg.ascii >= 32 && msg.ascii <= 127 &&
 			_text.size() < _maxLen) {
 		if (_isNumeric && (msg.ascii < '0' || msg.ascii > '9'))
 			return true;
 
 		_text += msg.ascii;
-		drawText();
 
 		// Single character numeric fields, particular spell
 		// level/number selection, return immediately
-		if (_isNumeric && _maxLen == 1)
+		if (_isNumeric && _maxLen == 1) {
+			drawText();
 			msgAction(ActionMessage(KEYBIND_SELECT));
+		}
+
+		redraw();
+
+	} else if (msg.keycode == Common::KEYCODE_RETURN && !_text.empty()) {
+		drawText();
+		close();
+		_enterFn(_text);
 	}
 
-	return false;
+	return true;
 }
 
 bool TextEntry::msgAction(const ActionMessage &msg) {
-	switch (msg._action) {
-	case KEYBIND_ESCAPE:
+	if (msg._action == KEYBIND_ESCAPE) {
 		drawText();
 		close();
 		_abortFn();
-		return true;
-
-	case KEYBIND_SELECT:
-		drawText();
-		close();
-		_enterFn(_text);
-		return true;
-
-	default:
-		break;
 	}
 
-	return false;
+	return true;
 }
 
 } // namespace Views




More information about the Scummvm-git-logs mailing list