]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/MainTextEditor.c
Revert "ShellPkg: Make the USB mouse behavior in 'edit' consistent with 'hexedit'."
[mirror_edk2.git] / ShellPkg / Library / UefiShellDebug1CommandsLib / Edit / MainTextEditor.c
index 6e91719ade39228e5035567942973534e3da27a2..4eb7d9eee304dfc2937fcc169a981b5fc34d5c25 100644 (file)
@@ -40,7 +40,6 @@ extern BOOLEAN                FileBufferMouseNeedRefresh;
 extern EFI_EDITOR_FILE_BUFFER FileBufferBackupVar;\r
 \r
 EFI_EDITOR_GLOBAL_EDITOR      MainEditor;\r
-EFI_EDITOR_GLOBAL_EDITOR      MainEditorBackupVar;\r
 \r
 \r
 /**\r
@@ -1690,8 +1689,7 @@ GetTextY (
 /**\r
   Support mouse movement.  Move the cursor.\r
 \r
-  @param[in]   MouseState             The current mouse state.\r
-  @param[out]  BeforeLeftButtonDown   TRUE if the left button down. Helps with selections.\r
+  @param[in] MouseState     The current mouse state.\r
 \r
   @retval EFI_SUCCESS       The operation was successful.\r
   @retval EFI_NOT_FOUND     There was no mouse support found.\r
@@ -1699,8 +1697,7 @@ GetTextY (
 EFI_STATUS\r
 EFIAPI\r
 MainEditorHandleMouseInput (\r
-  IN  EFI_SIMPLE_POINTER_STATE        MouseState,\r
-  OUT BOOLEAN                         *BeforeLeftButtonDown\r
+  IN EFI_SIMPLE_POINTER_STATE       MouseState\r
   )\r
 {\r
 \r
@@ -1708,8 +1705,10 @@ MainEditorHandleMouseInput (
   INT32           TextY;\r
   UINTN           FRow;\r
   UINTN           FCol;\r
-  LIST_ENTRY      *Link;\r
+\r
+  LIST_ENTRY  *Link;\r
   EFI_EDITOR_LINE *Line;\r
+\r
   UINTN           Index;\r
   BOOLEAN         Action;\r
 \r
@@ -1762,27 +1761,10 @@ MainEditorHandleMouseInput (
     Line = CR (Link, EFI_EDITOR_LINE, Link, LINE_LIST_SIGNATURE);\r
 \r
     //\r
-    // dragging\r
     // beyond the line's column length\r
     //\r
-    if (FCol > Line->Size ) {\r
-      if (*BeforeLeftButtonDown) {\r
-\r
-        if (Line->Size == 0) {\r
-          if (FRow > 1) {\r
-            FRow--;\r
-            FCol = SHELL_EDIT_MAX_LINE_SIZE;\r
-          } else {\r
-            FRow  = 1;\r
-            FCol  = 1;\r
-          }\r
-\r
-        } else {\r
-          FCol = Line->Size ;\r
-        }\r
-      } else {\r
-        FCol      = Line->Size + 1;\r
-      }\r
+    if (FCol > Line->Size + 1) {\r
+      FCol = Line->Size + 1;\r
     }\r
 \r
     FileBufferMovePosition (FRow, FCol);\r
@@ -1791,24 +1773,8 @@ MainEditorHandleMouseInput (
 \r
     MainEditor.FileBuffer->MousePosition.Column = MainEditor.FileBuffer->DisplayPosition.Column;\r
 \r
-    *BeforeLeftButtonDown                       = TRUE;\r
-\r
     Action = TRUE;\r
-  } else {\r
-    //\r
-    // else of if LButton\r
-    //\r
-    // release LButton\r
-    //\r
-    if (*BeforeLeftButtonDown) {\r
-      Action = TRUE;\r
-    }\r
-    //\r
-    // mouse up\r
-    //\r
-    *BeforeLeftButtonDown = FALSE;\r
   }\r
-\r
   //\r
   // mouse has action\r
   //\r
@@ -1838,23 +1804,6 @@ MainEditorKeyInput (
   EFI_INPUT_KEY             Key;\r
   EFI_STATUS                Status;\r
   EFI_SIMPLE_POINTER_STATE  MouseState;\r
-  BOOLEAN                   BeforeMouseIsDown;\r
-  BOOLEAN                   MouseIsDown;\r
-  BOOLEAN                   FirstDown;\r
-  BOOLEAN                   MouseDrag;\r
-  UINTN                     FRow;\r
-  UINTN                     FCol;\r
-  UINTN                     SelectStartBackup;\r
-  UINTN                     SelectEndBackup;\r
-\r
-  //\r
-  // variable initialization\r
-  //\r
-  FRow          = 0;\r
-  FCol          = 0;\r
-  MouseIsDown   = FALSE;\r
-  FirstDown     = FALSE;\r
-  MouseDrag     = FALSE;\r
 \r
   do {\r
 \r
@@ -1877,105 +1826,10 @@ MainEditorKeyInput (
                                             &MouseState\r
                                             );\r
       if (!EFI_ERROR (Status)) {\r
-        BeforeMouseIsDown = MouseIsDown;\r
 \r
-        Status            = MainEditorHandleMouseInput (MouseState, &MouseIsDown);\r
+        Status = MainEditorHandleMouseInput (MouseState);\r
 \r
         if (!EFI_ERROR (Status)) {\r
-          if (!BeforeMouseIsDown) {\r
-            //\r
-            // mouse down\r
-            //\r
-            if (MouseIsDown) {\r
-              FRow              = FileBuffer.FilePosition.Row;\r
-              FCol              = FileBuffer.FilePosition.Column;\r
-              SelectStartBackup = MainEditor.SelectStart;\r
-              SelectEndBackup   = MainEditor.SelectEnd;\r
-\r
-              FirstDown         = TRUE;\r
-            }\r
-          } else {\r
-\r
-            SelectStartBackup = MainEditor.SelectStart;\r
-            SelectEndBackup   = MainEditor.SelectEnd;\r
-\r
-            //\r
-            // begin to drag\r
-            //\r
-            if (MouseIsDown) {\r
-              if (FirstDown) {\r
-                if (MouseState.RelativeMovementX || MouseState.RelativeMovementY) {\r
-                  MainEditor.SelectStart = 0;\r
-                  MainEditor.SelectEnd   = 0;\r
-                  MainEditor.SelectStart = (FRow - 1) * SHELL_EDIT_MAX_LINE_SIZE + FCol;\r
-\r
-                  MouseDrag               = TRUE;\r
-                  FirstDown               = FALSE;\r
-                }\r
-              } else {\r
-                if ((\r
-                      (FileBuffer.FilePosition.Row - 1) *\r
-                      SHELL_EDIT_MAX_LINE_SIZE +\r
-                      FileBuffer.FilePosition.Column\r
-                    ) >= MainEditor.SelectStart\r
-                   ) {\r
-                  MainEditor.SelectEnd = (FileBuffer.FilePosition.Row - 1) *\r
-                                          SHELL_EDIT_MAX_LINE_SIZE +\r
-                                          FileBuffer.FilePosition.Column;\r
-                } else {\r
-                  MainEditor.SelectEnd = 0;\r
-                }\r
-              }\r
-              //\r
-              // end of if RelativeX/Y\r
-              //\r
-            } else {\r
-              //\r
-              // mouse is up\r
-              //\r
-              if (MouseDrag) {\r
-                if (FileBufferGetTotalSize () == 0) {\r
-                  MainEditor.SelectStart = 0;\r
-                  MainEditor.SelectEnd   = 0;\r
-                  FirstDown               = FALSE;\r
-                  MouseDrag               = FALSE;\r
-                }\r
-\r
-                if ((\r
-                      (FileBuffer.FilePosition.Row - 1) *\r
-                      SHELL_EDIT_MAX_LINE_SIZE +\r
-                      FileBuffer.FilePosition.Column\r
-                    ) >= MainEditor.SelectStart\r
-                   ) {\r
-                  MainEditor.SelectEnd = (FileBuffer.FilePosition.Row - 1) *\r
-                                          SHELL_EDIT_MAX_LINE_SIZE +\r
-                                          FileBuffer.FilePosition.Column;\r
-                } else {\r
-                  MainEditor.SelectEnd = 0;\r
-                }\r
-\r
-                if (MainEditor.SelectEnd == 0) {\r
-                  MainEditor.SelectStart = 0;\r
-                }\r
-              }\r
-\r
-              FirstDown = FALSE;\r
-              MouseDrag = FALSE;\r
-            }\r
-\r
-            if (SelectStartBackup != MainEditor.SelectStart || SelectEndBackup != MainEditor.SelectEnd) {\r
-              if ((SelectStartBackup - 1) / SHELL_EDIT_MAX_LINE_SIZE != (MainEditor.SelectStart - 1) / SHELL_EDIT_MAX_LINE_SIZE) {\r
-                FileBufferNeedRefresh = TRUE;\r
-              } else {\r
-                if ((SelectEndBackup - 1) / SHELL_EDIT_MAX_LINE_SIZE != (MainEditor.SelectEnd - 1) / SHELL_EDIT_MAX_LINE_SIZE) {\r
-                  FileBufferNeedRefresh = TRUE;\r
-                } else {\r
-                  FileBufferOnlyLineNeedRefresh = TRUE;\r
-                }\r
-              }\r
-            }\r
-          }\r
-\r
           EditorMouseAction           = TRUE;\r
           FileBufferMouseNeedRefresh  = TRUE;\r
         } else if (Status == EFI_LOAD_ERROR) {\r
@@ -2076,11 +1930,7 @@ MainEditorBackup (
   VOID\r
   )\r
 {\r
-  MainEditorBackupVar.SelectStart  = MainEditor.SelectStart;\r
-  MainEditorBackupVar.SelectEnd    = MainEditor.SelectEnd;\r
   FileBufferBackup ();\r
   \r
   return EFI_SUCCESS;\r
 }\r
-\r
-\r