summaryrefslogtreecommitdiff
path: root/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/MainTextEditor.c
diff options
context:
space:
mode:
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;
}
-
-