summaryrefslogtreecommitdiff
path: root/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/MainTextEditor.c
diff options
context:
space:
mode:
authorRuiyu Ni <ruiyu.ni@intel.com>2016-07-05 13:28:53 +0800
committerRuiyu Ni <ruiyu.ni@intel.com>2016-07-08 14:54:30 +0800
commit664fd5877d8b144b0d2cc667feab37286986ffb6 (patch)
tree5cf5120e653fe4faf815c58a9146b65d1e2f2190 /ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/MainTextEditor.c
parent1d32246161af275d7a2d17ade4a8fa53ea37a556 (diff)
downloadedk2-platforms-664fd5877d8b144b0d2cc667feab37286986ffb6.tar.xz
Revert "ShellPkg: Make the USB mouse behavior in 'edit' consistent with 'hexedit'."
This reverts commit ee60bd2b6aa473fdff6af3bfc62203ed8ca5c52a and e36ed7a84b2768443de22371f0aad5cf502328b1. The two commits enhanced 'edit' to support text selection through mouse. But the code introduced some bugs resulting the text selection behavior is not very usable and potentially hang in certain platforms. So I'd like to revert them firstly. If there is strong requirement for the text selection through mouse in 'edit' I will refine and re-add the code. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jarben.carsey@intel.com>
Diffstat (limited to 'ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/MainTextEditor.c')
-rw-r--r--ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/MainTextEditor.c166
1 files changed, 8 insertions, 158 deletions
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/MainTextEditor.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/MainTextEditor.c
index 6e91719ade..4eb7d9eee3 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/MainTextEditor.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/MainTextEditor.c
@@ -40,7 +40,6 @@ extern BOOLEAN FileBufferMouseNeedRefresh;
extern EFI_EDITOR_FILE_BUFFER FileBufferBackupVar;
EFI_EDITOR_GLOBAL_EDITOR MainEditor;
-EFI_EDITOR_GLOBAL_EDITOR MainEditorBackupVar;
/**
@@ -1690,8 +1689,7 @@ GetTextY (
/**
Support mouse movement. Move the cursor.
- @param[in] MouseState The current mouse state.
- @param[out] BeforeLeftButtonDown TRUE if the left button down. Helps with selections.
+ @param[in] MouseState The current mouse state.
@retval EFI_SUCCESS The operation was successful.
@retval EFI_NOT_FOUND There was no mouse support found.
@@ -1699,8 +1697,7 @@ GetTextY (
EFI_STATUS
EFIAPI
MainEditorHandleMouseInput (
- IN EFI_SIMPLE_POINTER_STATE MouseState,
- OUT BOOLEAN *BeforeLeftButtonDown
+ IN EFI_SIMPLE_POINTER_STATE MouseState
)
{
@@ -1708,8 +1705,10 @@ MainEditorHandleMouseInput (
INT32 TextY;
UINTN FRow;
UINTN FCol;
- LIST_ENTRY *Link;
+
+ LIST_ENTRY *Link;
EFI_EDITOR_LINE *Line;
+
UINTN Index;
BOOLEAN Action;
@@ -1762,27 +1761,10 @@ MainEditorHandleMouseInput (
Line = CR (Link, EFI_EDITOR_LINE, Link, LINE_LIST_SIGNATURE);
//
- // dragging
// beyond the line's column length
//
- if (FCol > Line->Size ) {
- if (*BeforeLeftButtonDown) {
-
- if (Line->Size == 0) {
- if (FRow > 1) {
- FRow--;
- FCol = SHELL_EDIT_MAX_LINE_SIZE;
- } else {
- FRow = 1;
- FCol = 1;
- }
-
- } else {
- FCol = Line->Size ;
- }
- } else {
- FCol = Line->Size + 1;
- }
+ if (FCol > Line->Size + 1) {
+ FCol = Line->Size + 1;
}
FileBufferMovePosition (FRow, FCol);
@@ -1791,24 +1773,8 @@ MainEditorHandleMouseInput (
MainEditor.FileBuffer->MousePosition.Column = MainEditor.FileBuffer->DisplayPosition.Column;
- *BeforeLeftButtonDown = TRUE;
-
Action = TRUE;
- } else {
- //
- // else of if LButton
- //
- // release LButton
- //
- if (*BeforeLeftButtonDown) {
- Action = TRUE;
- }
- //
- // mouse up
- //
- *BeforeLeftButtonDown = FALSE;
}
-
//
// mouse has action
//
@@ -1838,23 +1804,6 @@ MainEditorKeyInput (
EFI_INPUT_KEY Key;
EFI_STATUS Status;
EFI_SIMPLE_POINTER_STATE MouseState;
- BOOLEAN BeforeMouseIsDown;
- BOOLEAN MouseIsDown;
- BOOLEAN FirstDown;
- BOOLEAN MouseDrag;
- UINTN FRow;
- UINTN FCol;
- UINTN SelectStartBackup;
- UINTN SelectEndBackup;
-
- //
- // variable initialization
- //
- FRow = 0;
- FCol = 0;
- MouseIsDown = FALSE;
- FirstDown = FALSE;
- MouseDrag = FALSE;
do {
@@ -1877,105 +1826,10 @@ MainEditorKeyInput (
&MouseState
);
if (!EFI_ERROR (Status)) {
- BeforeMouseIsDown = MouseIsDown;
- Status = MainEditorHandleMouseInput (MouseState, &MouseIsDown);
+ Status = MainEditorHandleMouseInput (MouseState);
if (!EFI_ERROR (Status)) {
- if (!BeforeMouseIsDown) {
- //
- // mouse down
- //
- if (MouseIsDown) {
- FRow = FileBuffer.FilePosition.Row;
- FCol = FileBuffer.FilePosition.Column;
- SelectStartBackup = MainEditor.SelectStart;
- SelectEndBackup = MainEditor.SelectEnd;
-
- FirstDown = TRUE;
- }
- } else {
-
- SelectStartBackup = MainEditor.SelectStart;
- SelectEndBackup = MainEditor.SelectEnd;
-
- //
- // begin to drag
- //
- if (MouseIsDown) {
- if (FirstDown) {
- if (MouseState.RelativeMovementX || MouseState.RelativeMovementY) {
- MainEditor.SelectStart = 0;
- MainEditor.SelectEnd = 0;
- MainEditor.SelectStart = (FRow - 1) * SHELL_EDIT_MAX_LINE_SIZE + FCol;
-
- MouseDrag = TRUE;
- FirstDown = FALSE;
- }
- } else {
- if ((
- (FileBuffer.FilePosition.Row - 1) *
- SHELL_EDIT_MAX_LINE_SIZE +
- FileBuffer.FilePosition.Column
- ) >= MainEditor.SelectStart
- ) {
- MainEditor.SelectEnd = (FileBuffer.FilePosition.Row - 1) *
- SHELL_EDIT_MAX_LINE_SIZE +
- FileBuffer.FilePosition.Column;
- } else {
- MainEditor.SelectEnd = 0;
- }
- }
- //
- // end of if RelativeX/Y
- //
- } else {
- //
- // mouse is up
- //
- if (MouseDrag) {
- if (FileBufferGetTotalSize () == 0) {
- MainEditor.SelectStart = 0;
- MainEditor.SelectEnd = 0;
- FirstDown = FALSE;
- MouseDrag = FALSE;
- }
-
- if ((
- (FileBuffer.FilePosition.Row - 1) *
- SHELL_EDIT_MAX_LINE_SIZE +
- FileBuffer.FilePosition.Column
- ) >= MainEditor.SelectStart
- ) {
- MainEditor.SelectEnd = (FileBuffer.FilePosition.Row - 1) *
- SHELL_EDIT_MAX_LINE_SIZE +
- FileBuffer.FilePosition.Column;
- } else {
- MainEditor.SelectEnd = 0;
- }
-
- if (MainEditor.SelectEnd == 0) {
- MainEditor.SelectStart = 0;
- }
- }
-
- FirstDown = FALSE;
- MouseDrag = FALSE;
- }
-
- if (SelectStartBackup != MainEditor.SelectStart || SelectEndBackup != MainEditor.SelectEnd) {
- if ((SelectStartBackup - 1) / SHELL_EDIT_MAX_LINE_SIZE != (MainEditor.SelectStart - 1) / SHELL_EDIT_MAX_LINE_SIZE) {
- FileBufferNeedRefresh = TRUE;
- } else {
- if ((SelectEndBackup - 1) / SHELL_EDIT_MAX_LINE_SIZE != (MainEditor.SelectEnd - 1) / SHELL_EDIT_MAX_LINE_SIZE) {
- FileBufferNeedRefresh = TRUE;
- } else {
- FileBufferOnlyLineNeedRefresh = TRUE;
- }
- }
- }
- }
-
EditorMouseAction = TRUE;
FileBufferMouseNeedRefresh = TRUE;
} else if (Status == EFI_LOAD_ERROR) {
@@ -2076,11 +1930,7 @@ MainEditorBackup (
VOID
)
{
- MainEditorBackupVar.SelectStart = MainEditor.SelectStart;
- MainEditorBackupVar.SelectEnd = MainEditor.SelectEnd;
FileBufferBackup ();
return EFI_SUCCESS;
}
-
-