]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Library/UefiShellDebug1CommandsLib/EditMenuBar.c
ShellPkg: Added the Ctrl based hot key and changed text editor's UI.
[mirror_edk2.git] / ShellPkg / Library / UefiShellDebug1CommandsLib / EditMenuBar.c
index 390c707bc6ecdd14c3ae81c50bca586c0571aab9..b721850300842acc7fb3a2232e4a8ff5217d50b8 100644 (file)
@@ -16,7 +16,8 @@
 #include "UefiShellDebug1CommandsLib.h"\r
 #include "EditStatusBar.h"\r
 \r
-EDITOR_MENU_ITEM  *MenuItems;\r
+EDITOR_MENU_ITEM   *MenuItems;\r
+MENU_ITEM_FUNCTION *ControlBasedMenuFunctions;\r
 UINTN                 NumItems;\r
 \r
 /**\r
@@ -32,7 +33,7 @@ MenuBarCleanup (
 }\r
 \r
 /**\r
-  Initializa the menu bar with the specified items.\r
+  Initialize the menu bar with the specified items.\r
 \r
   @param[in] Items              The items to display and their functions.\r
 \r
@@ -57,6 +58,22 @@ MenuBarInit (
   return EFI_SUCCESS;\r
 }\r
 \r
+/**\r
+  Initialize the control hot-key with the specified items.\r
+\r
+  @param[in] Items              The hot-key functions.\r
+\r
+  @retval EFI_SUCCESS           The initialization was correct.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+ControlHotKeyInit (\r
+  IN MENU_ITEM_FUNCTION  *Items\r
+  )\r
+{\r
+  ControlBasedMenuFunctions = Items;\r
+  return EFI_SUCCESS; \r
+}\r
 /**\r
   Refresh function for the menu bar.\r
 \r
@@ -150,3 +167,30 @@ MenuBarDispatchFunctionKey (
   return (MenuItems[Index].Function ());\r
 }\r
 \r
+/**\r
+  Function to dispatch the correct function based on a control-based key (ctrl+o...)\r
+\r
+  @param[in] Key                The pressed key.\r
+\r
+  @retval EFI_NOT_FOUND         The key was not a valid control-based key \r
+                                (an error was sent to the status bar).\r
+  @return EFI_SUCCESS.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+MenuBarDispatchControlHotKey (\r
+  IN CONST EFI_INPUT_KEY   *Key\r
+  )\r
+{\r
+  \r
+  if ((SCAN_CONTROL_Z < Key->UnicodeChar)\r
+    ||(NULL == ControlBasedMenuFunctions[Key->UnicodeChar]))\r
+  {\r
+      return EFI_NOT_FOUND;\r
+  }\r
+\r
+  ControlBasedMenuFunctions[Key->UnicodeChar]();\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+\r