Jaben,
Sorry for using a wrong email address of you.

Thanks,
Ray

> -----Original Message-----
> From: Ni, Ruiyu
> Sent: Thursday, July 7, 2016 12:37 PM
> To: edk2-devel@lists.01.org
> Cc: Ni, Ruiyu <ruiyu...@intel.com>; Jaben Carsey <jarben.car...@intel.com>
> Subject: [PATCH 2/2] Revert "ShellPkg: Make the USB mouse behavior in
> 'edit' consistent with 'hexedit'."
> 
> This reverts commit ee60bd2b6aa473fdff6af3bfc62203ed8ca5c52a.
> The above commit 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 this patch 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...@intel.com>
> Cc: Jaben Carsey <jaben.car...@intel.com>
> ---
>  .../UefiShellDebug1CommandsLib/Edit/FileBuffer.c   | 329 
> ++-------------------
>  .../UefiShellDebug1CommandsLib/Edit/FileBuffer.h   |  12 +-
>  .../Edit/MainTextEditor.c                          | 166 +----------
>  .../UefiShellDebug1CommandsLib/Edit/TextEditor.h   |   3 +-
>  .../Edit/TextEditorTypes.h                         |   9 +-
>  5 files changed, 39 insertions(+), 480 deletions(-)
> 
> diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.c
> b/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.c
> index fb0c76e..acd8512 100644
> --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.c
> +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.c
> @@ -1,7 +1,7 @@
>  /** @file
>    Implements filebuffer interface functions.
> 
> -  Copyright (c) 2005 - 2016, Intel Corporation. All rights reserved. <BR>
> +  Copyright (c) 2005 - 2015, Intel Corporation. All rights reserved.
> + <BR>
>    This program and the accompanying materials
>    are licensed and made available under the terms and conditions of the BSD
> License
>    which accompanies this distribution.  The full text of the license may be
> found at @@ -257,71 +257,6 @@ MoveLine (  }
> 
>  /**
> -  Decide if a point is in the already selected area.
> -
> -  @param[in] MouseRow     The row of the point to test.
> -  @param[in] MouseCol     The col of the point to test.
> -
> -  @retval TRUE      The point is in the selected area.
> -  @retval FALSE     The point is not in the selected area.
> -**/
> -BOOLEAN
> -FileBufferIsInSelectedArea (
> -  IN UINTN MouseRow,
> -  IN UINTN MouseCol
> -  )
> -{
> -  UINTN FRow;
> -  UINTN RowStart;
> -  UINTN RowEnd;
> -  UINTN ColStart;
> -  UINTN ColEnd;
> -  UINTN MouseColStart;
> -  UINTN MouseColEnd;
> -
> -  //
> -  // judge mouse position whether is in selected area
> -  //
> -  //
> -  // not select
> -  //
> -  if (MainEditor.SelectStart == 0 || MainEditor.SelectEnd == 0) {
> -    return FALSE;
> -  }
> -  //
> -  // calculate the select area
> -  //
> -  RowStart  = (MainEditor.SelectStart - 1) / SHELL_EDIT_MAX_LINE_SIZE + 1;
> -  RowEnd    = (MainEditor.SelectEnd - 1) / SHELL_EDIT_MAX_LINE_SIZE + 1;
> -
> -  ColStart  = (MainEditor.SelectStart - 1) % SHELL_EDIT_MAX_LINE_SIZE + 1;
> -  ColEnd    = (MainEditor.SelectEnd - 1) % SHELL_EDIT_MAX_LINE_SIZE + 1;
> -
> -  FRow      = FileBuffer.LowVisibleRange.Row + MouseRow - 2;
> -  if (FRow < RowStart || FRow > RowEnd) {
> -    return FALSE;
> -  }
> -
> -  if (FRow > RowStart) {
> -    ColStart = 1;
> -  }
> -
> -  if (FRow < RowEnd) {
> -    ColEnd = SHELL_EDIT_MAX_LINE_SIZE;
> -  }
> -
> -  MouseColStart = ColStart;
> -
> -  MouseColEnd = ColEnd;
> -
> -  if (MouseCol < MouseColStart || MouseCol > MouseColEnd) {
> -    return FALSE;
> -  }
> -
> -  return TRUE;
> -}
> -
> -/**
>    Function to update the 'screen' to display the mouse position.
> 
>    @retval EFI_SUCCESS           The backup operation was successful.
> @@ -376,29 +311,6 @@ FileBufferRestoreMousePosition (
> 
>        FColumn       = FileBuffer.LowVisibleRange.Column +
> FileBufferBackupVar.MousePosition.Column - 1;
> 
> -      if (FRow <= FileBuffer.NumLines) {
> -        CurrentLine = FileBuffer.CurrentLine;
> -        Line        = MoveLine (FRow - FileBuffer.FilePosition.Row);
> -        FileBuffer.CurrentLine = CurrentLine;
> -      }
> -
> -      //
> -      // if in selected area,
> -      // so do not need to refresh mouse
> -      //
> -      if (!FileBufferIsInSelectedArea (
> -            FileBufferBackupVar.MousePosition.Row,
> -            FileBufferBackupVar.MousePosition.Column
> -            ) ||
> -          (Line == NULL || FColumn > Line->Size)
> -      ) {
> -        gST->ConOut->SetAttribute (gST->ConOut, Orig.Data);
> -      } else {
> -        gST->ConOut->SetAttribute (gST->ConOut, New.Data & 0x7F);
> -      }
> -
> -      Line = NULL;
> -
>        HasCharacter  = TRUE;
>        if (FRow > FileBuffer.NumLines) {
>          HasCharacter = FALSE;
> @@ -431,15 +343,8 @@ FileBufferRestoreMousePosition (
>        //
>        // set the new mouse position
>        //
> -      if (!FileBufferIsInSelectedArea (
> -            FileBuffer.MousePosition.Row,
> -            FileBuffer.MousePosition.Column
> -            )
> -      ) {
> -        gST->ConOut->SetAttribute (gST->ConOut, New.Data & 0x7F);
> -      } else {
> -        gST->ConOut->SetAttribute (gST->ConOut, Orig.Data);
> -      }
> +      gST->ConOut->SetAttribute (gST->ConOut, New.Data & 0x7F);
> +
>        //
>        // clear the old mouse position
>        //
> @@ -567,25 +472,18 @@ FileBufferCleanup (
> 
>  }
> 
> -
>  /**
> -  Print Line on Row
> +  Print a line specified by Line on a row specified by Row of the screen.
> 
> -  @param[in] Line     The lline to print.
> -  @param[in] Row      The row on screen ( begin from 1 ).
> -  @param[in] FRow     The FRow.
> -  @param[in] Orig     The original color.
> -  @param[in] New      The color to print with.
> +  @param[in] Line               The line to print.
> +  @param[in] Row                The row on the screen to print onto (begin 
> from
> 1).
> 
> -  @retval EFI_SUCCESS The operation was successful.
> +  @retval EFI_SUCCESS           The printing was successful.
>  **/
>  EFI_STATUS
>  FileBufferPrintLine (
> -  IN CONST EFI_EDITOR_LINE        *Line,
> -  IN CONST  UINTN                 Row,
> -  IN CONST  UINTN                 FRow,
> -  IN EFI_EDITOR_COLOR_UNION       Orig,
> -  IN EFI_EDITOR_COLOR_UNION       New
> +  IN CONST EFI_EDITOR_LINE  *Line,
> +  IN CONST UINTN            Row
>    )
>  {
> 
> @@ -593,42 +491,7 @@ FileBufferPrintLine (
>    UINTN   Limit;
>    CHAR16  *PrintLine;
>    CHAR16  *PrintLine2;
> -  CHAR16  *TempString;
> -  UINTN   BufLen;
> -  BOOLEAN Selected;
> -  UINTN   RowStart;
> -  UINTN   RowEnd;
> -  UINTN   ColStart;
> -  UINTN   ColEnd;
> -
> -  ColStart    = 0;
> -  ColEnd      = 0;
> -  Selected    = FALSE;
> -  TempString  = NULL;
> -
> -  //
> -  // print the selected area in opposite color
> -  //
> -  if (MainEditor.SelectStart != 0 && MainEditor.SelectEnd != 0) {
> -    RowStart  = (MainEditor.SelectStart - 1) / SHELL_EDIT_MAX_LINE_SIZE + 1;
> -    RowEnd    = (MainEditor.SelectEnd - 1) / SHELL_EDIT_MAX_LINE_SIZE + 1;
> -
> -    ColStart  = (MainEditor.SelectStart - 1) % SHELL_EDIT_MAX_LINE_SIZE + 1;
> -    ColEnd    = (MainEditor.SelectEnd - 1) % SHELL_EDIT_MAX_LINE_SIZE + 1;
> -
> -    if (FRow >= RowStart && FRow <= RowEnd) {
> -      Selected = TRUE;
> -    }
> -
> -    if (FRow > RowStart) {
> -      ColStart = 1;
> -    }
> -
> -    if (FRow < RowEnd) {
> -      ColEnd = Line->Size + 1;
> -    }
> -
> -  }
> +  UINTN   BufLen;
> 
>    //
>    // print start from correct character @@ -656,64 +519,15 @@
> FileBufferPrintLine (
> 
>    ShellCopySearchAndReplace(PrintLine, PrintLine2, BufLen * 2, L"%", L"^%",
> FALSE, FALSE);
> 
> -  if (!Selected) {
> -    ShellPrintEx (
> -      0,
> -      (INT32)Row - 1,
> -      L"%s",
> -      PrintLine2
> -      );
> -  } else {
> -    //
> -    // If the current line is selected.
> -    //
> -    if (ColStart != 1) {
> -      gST->ConOut->SetAttribute (gST->ConOut, Orig.Data & 0x7F);
> -      TempString = AllocateCopyPool ((ColStart - 1) * sizeof(CHAR16),
> PrintLine2);
> -      ASSERT (TempString != NULL);
> -      ShellPrintEx (
> -        0,
> -        (INT32)Row - 1,
> -        L"%s",
> -        TempString
> -      );
> -      FreePool (TempString);
> -    }
> -
> -    gST->ConOut->SetAttribute (gST->ConOut, New.Data & 0x7F);
> -    TempString = AllocateCopyPool (
> -                  (ColEnd - ColStart + 1)  * sizeof(CHAR16),
> -                  PrintLine2 + ColStart - 1
> -                  );
> -    ASSERT (TempString != NULL);
> -    ShellPrintEx (
> -      (INT32)ColStart - 1,
> -      (INT32)Row - 1,
> -      L"%s",
> -      TempString
> -      );
> -    FreePool (TempString);
> -
> -    if (ColEnd != SHELL_EDIT_MAX_LINE_SIZE) {
> -      gST->ConOut->SetAttribute (gST->ConOut, Orig.Data & 0x7F);
> -      TempString = AllocateCopyPool (
> -                    (SHELL_EDIT_MAX_LINE_SIZE - ColEnd + 1)  * 
> sizeof(CHAR16),
> -                    PrintLine2 + ColEnd - 1
> -                    );
> -      ASSERT (TempString != NULL);
> -      ShellPrintEx (
> -        (INT32)ColEnd - 1,
> -        (INT32)Row - 1,
> -        L"%s",
> -        TempString
> -      );
> -      FreePool (TempString);
> -    }
> -  }
> +  ShellPrintEx (
> +    0,
> +    (INT32)Row - 1,
> +    L"%s",
> +    PrintLine2
> +    );
> 
>    FreePool (PrintLine);
>    FreePool (PrintLine2);
> -  gST->ConOut->SetAttribute (gST->ConOut, Orig.Data & 0x7F);
> 
>    return EFI_SUCCESS;
>  }
> @@ -754,18 +568,6 @@ FileBufferRefresh (
>    LIST_ENTRY  *Link;
>    EFI_EDITOR_LINE *Line;
>    UINTN           Row;
> -  EFI_EDITOR_COLOR_UNION Orig;
> -  EFI_EDITOR_COLOR_UNION New;
> -
> -  UINTN                   StartRow;
> -  UINTN                   EndRow;
> -  UINTN                   FStartRow;
> -  UINTN                   Tmp;
> -
> -  Orig                  = MainEditor.ColorAttributes;
> -  New.Data              = 0;
> -  New.Colors.Foreground = Orig.Colors.Background;
> -  New.Colors.Background = Orig.Colors.Foreground;
> 
>    //
>    // if it's the first time after editor launch, so should refresh @@ -777,10
> +579,13 @@ FileBufferRefresh (
>      //
>      if (!FileBufferNeedRefresh &&
>          !FileBufferOnlyLineNeedRefresh &&
> -        FileBufferBackupVar.LowVisibleRange.Row ==
> FileBuffer.LowVisibleRange.Row
> +        FileBufferBackupVar.LowVisibleRange.Row ==
> FileBuffer.LowVisibleRange.Row &&
> +        FileBufferBackupVar.LowVisibleRange.Column ==
> + FileBuffer.LowVisibleRange.Column
>          ) {
> +
>        FileBufferRestoreMousePosition ();
>        FileBufferRestorePosition ();
> +
>        return EFI_SUCCESS;
>      }
>    }
> @@ -791,60 +596,19 @@ FileBufferRefresh (
>    // only need to refresh current line
>    //
>    if (FileBufferOnlyLineNeedRefresh &&
> -      FileBufferBackupVar.LowVisibleRange.Row ==
> FileBuffer.LowVisibleRange.Row
> +      FileBufferBackupVar.LowVisibleRange.Row ==
> FileBuffer.LowVisibleRange.Row &&
> +      FileBufferBackupVar.LowVisibleRange.Column ==
> + FileBuffer.LowVisibleRange.Column
>        ) {
> 
>      EditorClearLine (FileBuffer.DisplayPosition.Row,
> MainEditor.ScreenSize.Column, MainEditor.ScreenSize.Row);
>      FileBufferPrintLine (
>        FileBuffer.CurrentLine,
> -      FileBuffer.DisplayPosition.Row,
> -      FileBuffer.FilePosition.Row,
> -      Orig,
> -      New
> +      FileBuffer.DisplayPosition.Row
>        );
>    } else {
>      //
>      // the whole edit area need refresh
>      //
> -    if (EditorMouseAction && MainEditor.SelectStart != 0 &&
> MainEditor.SelectEnd != 0) {
> -      if (MainEditor.SelectStart != MainEditorBackupVar.SelectStart) {
> -        if (MainEditor.SelectStart >= MainEditorBackupVar.SelectStart &&
> MainEditorBackupVar.SelectStart != 0) {
> -          StartRow = (MainEditorBackupVar.SelectStart - 1) /
> SHELL_EDIT_MAX_LINE_SIZE + 1;
> -        } else {
> -          StartRow = (MainEditor.SelectStart - 1) / SHELL_EDIT_MAX_LINE_SIZE 
> +
> 1;
> -        }
> -      } else {
> -        StartRow = (MainEditor.SelectStart - 1) / SHELL_EDIT_MAX_LINE_SIZE +
> 1;
> -      }
> -
> -      if (MainEditor.SelectEnd <= MainEditorBackupVar.SelectEnd) {
> -        EndRow = (MainEditorBackupVar.SelectEnd - 1) /
> SHELL_EDIT_MAX_LINE_SIZE + 1;
> -      } else {
> -        EndRow = (MainEditor.SelectEnd - 1) / SHELL_EDIT_MAX_LINE_SIZE + 1;
> -      }
> -
> -      //
> -      // swap
> -      //
> -      if (StartRow > EndRow) {
> -        Tmp       = StartRow;
> -        StartRow  = EndRow;
> -        EndRow    = Tmp;
> -      }
> -
> -      FStartRow = StartRow;
> -
> -      StartRow  = 2 + StartRow - FileBuffer.LowVisibleRange.Row;
> -      EndRow    = 2 + EndRow - FileBuffer.LowVisibleRange.Row;
> -
> -    } else {
> -      //
> -      // not mouse selection actions
> -      //
> -      FStartRow = FileBuffer.LowVisibleRange.Row;
> -      StartRow  = 2;
> -      EndRow    = (MainEditor.ScreenSize.Row - 1);
> -    }
> 
>      //
>      // no line
> @@ -874,20 +638,15 @@ FileBufferRefresh (
>        //
>        // print line at row
>        //
> -      FileBufferPrintLine (Line,
> -        Row,
> -        FileBuffer.LowVisibleRange.Row + Row - 2,
> -        Orig,
> -        New
> -        );
> +      FileBufferPrintLine (Line, Row);
> 
>        Link = Link->ForwardLink;
>        Row++;
> -    } while (Link != FileBuffer.ListHead && Row <= EndRow);
> +    } while (Link != FileBuffer.ListHead && Row <=
> + (MainEditor.ScreenSize.Row - 1));
>      //
>      // while not file end and not screen full
>      //
> -    while (Row <= EndRow) {
> +    while (Row <= (MainEditor.ScreenSize.Row - 1)) {
>        EditorClearLine (Row, MainEditor.ScreenSize.Column,
> MainEditor.ScreenSize.Row);
>        Row++;
>      }
> @@ -3610,39 +3369,3 @@ FileBufferSetModified (
>    FileBuffer.FileModified = TRUE;
>  }
> 
> -
> -/**
> -  Get the size of the open buffer.
> -
> -  @retval The size in bytes.
> -**/
> -UINTN
> -FileBufferGetTotalSize (
> -  VOID
> -  )
> -{
> -  UINTN             Size;
> -
> -  EFI_EDITOR_LINE   *Line;
> -
> -  //
> -  // calculate the total size of whole line list's buffer
> -  //
> -  if (FileBuffer.Lines == NULL) {
> -    return 0;
> -  }
> -
> -  Line = CR (
> -          FileBuffer.ListHead->BackLink,
> -          EFI_EDITOR_LINE,
> -          Link,
> -          LINE_LIST_SIGNATURE
> -          );
> -  //
> -  // one line at most 0x50
> -  //
> -  Size = SHELL_EDIT_MAX_LINE_SIZE * (FileBuffer.NumLines - 1) + Line->Size;
> -
> -  return Size;
> -}
> -
> diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.h
> b/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.h
> index 627bb84..9d4a08d 100644
> --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.h
> +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.h
> @@ -1,7 +1,7 @@
>  /** @file
>    Declares filebuffer interface functions.
> 
> -  Copyright (c) 2005 - 2016, Intel Corporation. All rights reserved. <BR>
> +  Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved.
> + <BR>
>    This program and the accompanying materials
>    are licensed and made available under the terms and conditions of the BSD
> License
>    which accompanies this distribution.  The full text of the license may be
> found at @@ -260,14 +260,4 @@ FileBufferSetModified (
>    VOID
>    );
> 
> -/**
> -  Get the size of the open buffer.
> -
> -  @retval The size in bytes.
> -**/
> -UINTN
> -FileBufferGetTotalSize (
> -  VOID
> -  );
> -
>  #endif
> diff --git
> a/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/MainTextEditor.c
> b/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/MainTextEditor.c
> index 6e91719..4eb7d9e 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;
>  }
> -
> -
> diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/TextEditor.h
> b/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/TextEditor.h
> index 54dc7de..774f01a 100644
> --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/TextEditor.h
> +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/TextEditor.h
> @@ -1,7 +1,7 @@
>  /** @file
>    Main include file for Edit shell Debug1 function.
> 
> -  Copyright (c) 2005 - 2016, Intel Corporation. All rights reserved. <BR>
> +  Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved.
> + <BR>
>    This program and the accompanying materials
>    are licensed and made available under the terms and conditions of the BSD
> License
>    which accompanies this distribution.  The full text of the license may be
> found at @@ -26,7 +26,6 @@  #include "Misc.h"
> 
>  extern EFI_EDITOR_GLOBAL_EDITOR MainEditor; -extern
> EFI_EDITOR_GLOBAL_EDITOR MainEditorBackupVar;
>  extern BOOLEAN                  EditorFirst;
>  extern BOOLEAN                  EditorExit;
> 
> diff --git
> a/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/TextEditorTypes.h
> b/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/TextEditorTypes.h
> index 43e3558..dfd56dd 100644
> --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/TextEditorTypes.h
> +++
> b/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/TextEditorTypes.h
> @@ -1,7 +1,7 @@
>  /** @file
>    Declares editor types.
> 
> -  Copyright (c) 2005 - 2016, Intel Corporation. All rights reserved. <BR>
> +  Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved.
> + <BR>
>    This program and the accompanying materials
>    are licensed and made available under the terms and conditions of the BSD
> License
>    which accompanies this distribution.  The full text of the license may be
> found at @@ -19,9 +19,8 @@  #include "EditTitleBar.h"
>  #include "EditMenuBar.h"
> 
> -#define MIN_POOL_SIZE                 125
> -#define MAX_STRING_LENGTH             127
> -#define SHELL_EDIT_MAX_LINE_SIZE      0x50
> +#define MIN_POOL_SIZE         125
> +#define MAX_STRING_LENGTH     127
> 
>  typedef struct {
>    UINTN Row;
> @@ -98,8 +97,6 @@ typedef struct {
>    INT32                       MouseAccumulatorX;
>    INT32                       MouseAccumulatorY;
> 
> -  UINTN                       SelectStart;          // starting from 1
> -  UINTN                       SelectEnd;            // starting from 1
>  } EFI_EDITOR_GLOBAL_EDITOR;
> 
>  #endif
> --
> 2.8.3.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to