[Scummvm-git-logs] scummvm master -> 068fe4b88513e1861373d89bde41171b7c206ea5

sluicebox noreply at scummvm.org
Thu Dec 5 10:43:33 UTC 2024


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:
068fe4b885 SCI: Fix Menu display of F10 keyboard shortcut


Commit: 068fe4b88513e1861373d89bde41171b7c206ea5
    https://github.com/scummvm/scummvm/commit/068fe4b88513e1861373d89bde41171b7c206ea5
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-12-05T02:43:16-08:00

Commit Message:
SCI: Fix Menu display of F10 keyboard shortcut

Fixes bug #15557

Thanks to @ATMcashpoint for reporting this

Changed paths:
    engines/sci/graphics/menu.cpp


diff --git a/engines/sci/graphics/menu.cpp b/engines/sci/graphics/menu.cpp
index 91728cb4021..0fea1671291 100644
--- a/engines/sci/graphics/menu.cpp
+++ b/engines/sci/graphics/menu.cpp
@@ -160,6 +160,7 @@ void GfxMenu::kernelAddEntry(const Common::String &title, Common::String content
 			content.setChar(toupper(content[tempPos]), tempPos);
 		}
 		if (functionPos) {
+			// "#1" => "F1". Needs extra handling for F10; see below.
 			content.setChar(SCI_MENU_REPLACE_ONFUNCTION, functionPos);
 			int tempPos = functionPos + 1;
 			if (tempPos >= contentSize)
@@ -248,6 +249,17 @@ void GfxMenu::kernelAddEntry(const Common::String &title, Common::String content
 			} else if (itemEntry->textRightAligned == "=") {
 				itemEntry->keyPress = '=';
 			}
+
+			// Handle "F10". The parser built the keypress text from the menu string
+			// in place by replacing each control character with a display character.
+			// This assumed that the display text never exceeds the control text, but
+			// this is not the case for "#0" => "F10", so it must be patched. Bug #15557
+			if (itemEntry->keyPress == kSciKeyF10) {
+				size_t f10Pos = itemEntry->textRightAligned.find("F0");
+				if (f10Pos != Common::String::npos) {
+					itemEntry->textRightAligned.insertChar('1', f10Pos + 1);
+				}
+			}
 		}
 
 		if (tagPos) {




More information about the Scummvm-git-logs mailing list