public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* Re: [edk2-devel] [PATCH V3] MdeModulePkg/BootManagerMenuApp: Limit string drawing within one line
       [not found] <16A89C34DEA6347B.26412@groups.io>
@ 2021-09-28  5:17 ` Gao, Zhichao
  2021-09-28  5:26   ` 回复: " gaoliming
  0 siblings, 1 reply; 4+ messages in thread
From: Gao, Zhichao @ 2021-09-28  5:17 UTC (permalink / raw)
  To: devel@edk2.groups.io, Gao, Zhichao; +Cc: Wang, Jian J, Liming Gao, Ni, Ray

Hi Liming/Ray,

I have updated the commit message and the BZ comments. Do you agree to merge the code?

Thanks,
Zhichao

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Gao,
> Zhichao
> Sent: Monday, September 27, 2021 3:10 PM
> To: devel@edk2.groups.io
> Cc: Wang, Jian J <jian.j.wang@intel.com>; Liming Gao
> <gaoliming@byosoft.com.cn>; Ni, Ray <ray.ni@intel.com>
> Subject: [edk2-devel] [PATCH V3] MdeModulePkg/BootManagerMenuApp:
> Limit string drawing within one line
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3590
> 
> Limit the draw box always within the screen's column and row.
> Limit the string drawing within one line.For the incompleted string the last 3
> characters in one line wouldbe replaced with "...".
> 
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Ray Ni <ray.ni@intel.com>
> Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>Reviewed-by: Ray Ni
> <ray.ni@intel.com> ---V2:Drop the change in UefiBootManagerLib in V1.Add
> the limitation in BootManagerMenuApp instead.V3:Update the commit
> message only.
>  .../BootManagerMenuApp/BootManagerMenu.c      | 72
> ++++++++++++++++++-
>  1 file changed, 69 insertions(+), 3 deletions(-)
> 
> diff --git
> a/MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenu.
> c
> b/MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenu.
> c
> index 9e729074ec..d4bdeba073 100644
> ---
> a/MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenu.
> c
> +++
> b/MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenu.
> c
> @@ -1,7 +1,7 @@
>  /** @file   The application to show the Boot Manager Menu. -Copyright (c)
> 2011 - 2018, Intel Corporation. All rights reserved.<BR>+Copyright (c) 2011 -
> 2021, Intel Corporation. All rights reserved.<BR> SPDX-License-Identifier:
> BSD-2-Clause-Patent  **/@@ -45,9 +45,56 @@ PrintStringAt (
>    IN CHAR16    *String   ) {+  UINTN         ScreenWidth;+  UINTN
> ScreenRows;+  CHAR16        *TurncateString;+  EFI_STATUS    Status;+  UINTN
> ShowingLength;    gST->ConOut->SetCursorPosition (gST->ConOut, Column,
> Row);-  return Print (L"%s", String);++  gST->ConOut->QueryMode (+
> gST->ConOut,+                 gST->ConOut->Mode->Mode,+
> &ScreenWidth,+                 &ScreenRows+                 );++  if (Column >
> (ScreenWidth - 1) || Row > (ScreenRows - 1)) {+    return 0;+  }++  if ((StrLen
> (String) + Column) > (ScreenWidth - 1)) {+    //+    // |      - ScreenWidth -       |+
> // ...Column.....................+    // TurncateString length should leave one
> character for draw box and+    // require one character for string end.+    //+
> ShowingLength = ScreenWidth - Column - 1;+    TurncateString = AllocatePool
> ((ShowingLength + 1) * sizeof (CHAR16));++    if (TurncateString == NULL) {+
> return 0;+    }++    Status = StrnCpyS (TurncateString, ShowingLength + 1,
> String, ShowingLength - 3);++    if (EFI_ERROR (Status)) {+      FreePool
> (TurncateString);+      return 0;+    }++    *(TurncateString + ShowingLength - 3)
> = L'.';+    *(TurncateString + ShowingLength - 2) = L'.';+    *(TurncateString +
> ShowingLength - 1) = L'.';+    *(TurncateString + ShowingLength)     = L'\0';+
> ShowingLength = Print (L"%s", TurncateString);+    FreePool
> (TurncateString);+    return ShowingLength;+  } else {+    return Print (L"%s",
> String);+  } }  /**@@ -68,7 +115,22 @@ PrintCharAt (
>    CHAR16       Character   ) {+  UINTN         ScreenWidth;+  UINTN
> ScreenRows;+   gST->ConOut->SetCursorPosition (gST->ConOut, Column,
> Row);++  gST->ConOut->QueryMode (+                 gST->ConOut,+                 gST-
> >ConOut->Mode->Mode,+                 &ScreenWidth,+
> &ScreenRows+                 );++  if (Column > (ScreenWidth - 1) || Row >
> (ScreenRows - 1)) {+    return 0;+  }+   return Print (L"%c", Character); } @@ -
> 193,7 +255,11 @@ InitializeBootMenuScreen (
>     MaxPrintRows = Row - 6;   UnSelectableItmes = TITLE_TOKEN_COUNT + 2 +
> HELP_TOKEN_COUNT + 2;-  BootMenuData->MenuScreen.Width =
> MaxStrWidth + 8;+  if (MaxStrWidth + 8 > Column) {+    BootMenuData-
> >MenuScreen.Width = Column;+  } else {+    BootMenuData-
> >MenuScreen.Width = MaxStrWidth + 8;+  }   if (BootMenuData->ItemCount
> + UnSelectableItmes > MaxPrintRows) {     BootMenuData-
> >MenuScreen.Height = MaxPrintRows;     BootMenuData-
> >ScrollBarControl.HasScrollBar = TRUE;--
> 2.31.1.windows.1
> 
> 
> 
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#81153): https://edk2.groups.io/g/devel/message/81153
> Mute This Topic: https://groups.io/mt/85895022/1768756
> Group Owner: devel+owner@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub [zhichao.gao@intel.com]
> -=-=-=-=-=-=
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* 回复: [edk2-devel] [PATCH V3] MdeModulePkg/BootManagerMenuApp: Limit string drawing within one line
  2021-09-28  5:17 ` [edk2-devel] [PATCH V3] MdeModulePkg/BootManagerMenuApp: Limit string drawing within one line Gao, Zhichao
@ 2021-09-28  5:26   ` gaoliming
  2021-09-29  1:32     ` Gao, Zhichao
  0 siblings, 1 reply; 4+ messages in thread
From: gaoliming @ 2021-09-28  5:26 UTC (permalink / raw)
  To: devel, zhichao.gao; +Cc: 'Wang, Jian J', 'Ni, Ray'

I am ok for this change. Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>

> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Gao, Zhichao
> 发送时间: 2021年9月28日 13:18
> 收件人: devel@edk2.groups.io; Gao, Zhichao <zhichao.gao@intel.com>
> 抄送: Wang, Jian J <jian.j.wang@intel.com>; Liming Gao
> <gaoliming@byosoft.com.cn>; Ni, Ray <ray.ni@intel.com>
> 主题: Re: [edk2-devel] [PATCH V3] MdeModulePkg/BootManagerMenuApp:
> Limit string drawing within one line
> 
> Hi Liming/Ray,
> 
> I have updated the commit message and the BZ comments. Do you agree to
> merge the code?
> 
> Thanks,
> Zhichao
> 
> > -----Original Message-----
> > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Gao,
> > Zhichao
> > Sent: Monday, September 27, 2021 3:10 PM
> > To: devel@edk2.groups.io
> > Cc: Wang, Jian J <jian.j.wang@intel.com>; Liming Gao
> > <gaoliming@byosoft.com.cn>; Ni, Ray <ray.ni@intel.com>
> > Subject: [edk2-devel] [PATCH V3] MdeModulePkg/BootManagerMenuApp:
> > Limit string drawing within one line
> >
> > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3590
> >
> > Limit the draw box always within the screen's column and row.
> > Limit the string drawing within one line.For the incompleted string the
last 3
> > characters in one line wouldbe replaced with "...".
> >
> > Cc: Jian J Wang <jian.j.wang@intel.com>
> > Cc: Liming Gao <gaoliming@byosoft.com.cn>
> > Cc: Ray Ni <ray.ni@intel.com>
> > Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>Reviewed-by: Ray Ni
> > <ray.ni@intel.com> ---V2:Drop the change in UefiBootManagerLib in
> V1.Add
> > the limitation in BootManagerMenuApp instead.V3:Update the commit
> > message only.
> >  .../BootManagerMenuApp/BootManagerMenu.c      | 72
> > ++++++++++++++++++-
> >  1 file changed, 69 insertions(+), 3 deletions(-)
> >
> > diff --git
> > a/MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenu.
> > c
> > b/MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenu.
> > c
> > index 9e729074ec..d4bdeba073 100644
> > ---
> > a/MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenu.
> > c
> > +++
> > b/MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenu.
> > c
> > @@ -1,7 +1,7 @@
> >  /** @file   The application to show the Boot Manager Menu. -Copyright
> (c)
> > 2011 - 2018, Intel Corporation. All rights reserved.<BR>+Copyright (c)
2011 -
> > 2021, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier:
> > BSD-2-Clause-Patent  **/@@ -45,9 +45,56 @@ PrintStringAt (
> >    IN CHAR16    *String   ) {+  UINTN         ScreenWidth;+
> UINTN
> > ScreenRows;+  CHAR16        *TurncateString;+  EFI_STATUS
> Status;+  UINTN
> > ShowingLength;    gST->ConOut->SetCursorPosition (gST->ConOut,
> Column,
> > Row);-  return Print (L"%s", String);++  gST->ConOut->QueryMode (+
> > gST->ConOut,+                 gST->ConOut->Mode->Mode,+
> > &ScreenWidth,+
> &ScreenRows+                 );++  if (Column >
> > (ScreenWidth - 1) || Row > (ScreenRows - 1)) {+    return 0;+  }++  if
> ((StrLen
> > (String) + Column) > (ScreenWidth - 1)) {+    //+    // |      -
> ScreenWidth -       |+
> > // ...Column.....................+    // TurncateString length should
leave one
> > character for draw box and+    // require one character for string end.+
> //+
> > ShowingLength = ScreenWidth - Column - 1;+    TurncateString =
> AllocatePool
> > ((ShowingLength + 1) * sizeof (CHAR16));++    if (TurncateString ==
NULL)
> {+
> > return 0;+    }++    Status = StrnCpyS (TurncateString, ShowingLength +
> 1,
> > String, ShowingLength - 3);++    if (EFI_ERROR (Status)) {+
FreePool
> > (TurncateString);+      return 0;+    }++    *(TurncateString +
> ShowingLength - 3)
> > = L'.';+    *(TurncateString + ShowingLength - 2) = L'.';+
> *(TurncateString +
> > ShowingLength - 1) = L'.';+    *(TurncateString + ShowingLength)     =
> L'\0';+
> > ShowingLength = Print (L"%s", TurncateString);+    FreePool
> > (TurncateString);+    return ShowingLength;+  } else {+    return Print
> (L"%s",
> > String);+  } }  /**@@ -68,7 +115,22 @@ PrintCharAt (
> >    CHAR16       Character   ) {+  UINTN         ScreenWidth;+
> UINTN
> > ScreenRows;+   gST->ConOut->SetCursorPosition (gST->ConOut, Column,
> > Row);++  gST->ConOut->QueryMode (+
> gST->ConOut,+                 gST-
> > >ConOut->Mode->Mode,+                 &ScreenWidth,+
> > &ScreenRows+                 );++  if (Column > (ScreenWidth - 1) ||
> Row >
> > (ScreenRows - 1)) {+    return 0;+  }+   return Print (L"%c",
Character); }
> @@ -
> > 193,7 +255,11 @@ InitializeBootMenuScreen (
> >     MaxPrintRows = Row - 6;   UnSelectableItmes =
> TITLE_TOKEN_COUNT + 2 +
> > HELP_TOKEN_COUNT + 2;-  BootMenuData->MenuScreen.Width =
> > MaxStrWidth + 8;+  if (MaxStrWidth + 8 > Column) {+    BootMenuData-
> > >MenuScreen.Width = Column;+  } else {+    BootMenuData-
> > >MenuScreen.Width = MaxStrWidth + 8;+  }   if
> (BootMenuData->ItemCount
> > + UnSelectableItmes > MaxPrintRows) {     BootMenuData-
> > >MenuScreen.Height = MaxPrintRows;     BootMenuData-
> > >ScrollBarControl.HasScrollBar = TRUE;--
> > 2.31.1.windows.1
> >
> >
> >
> > -=-=-=-=-=-=
> > Groups.io Links: You receive all messages sent to this group.
> > View/Reply Online (#81153):
> https://edk2.groups.io/g/devel/message/81153
> > Mute This Topic: https://groups.io/mt/85895022/1768756
> > Group Owner: devel+owner@edk2.groups.io
> > Unsubscribe: https://edk2.groups.io/g/devel/unsub
> [zhichao.gao@intel.com]
> > -=-=-=-=-=-=
> >
> 
> 
> 
> 
> 




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [edk2-devel] [PATCH V3] MdeModulePkg/BootManagerMenuApp: Limit string drawing within one line
  2021-09-28  5:26   ` 回复: " gaoliming
@ 2021-09-29  1:32     ` Gao, Zhichao
  2021-09-29  1:39       ` 回复: " gaoliming
  0 siblings, 1 reply; 4+ messages in thread
From: Gao, Zhichao @ 2021-09-29  1:32 UTC (permalink / raw)
  To: devel@edk2.groups.io, gaoliming@byosoft.com.cn; +Cc: Wang, Jian J, Ni, Ray

I have created the PR at: https://github.com/tianocore/edk2/pull/2019.
It shows all the checks are passed. Can you help to add your 'push' label and reopen it?

Thanks,
Zhichao

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of
> gaoliming
> Sent: Tuesday, September 28, 2021 1:27 PM
> To: devel@edk2.groups.io; Gao, Zhichao <zhichao.gao@intel.com>
> Cc: Wang, Jian J <jian.j.wang@intel.com>; Ni, Ray <ray.ni@intel.com>
> Subject: 回复: [edk2-devel] [PATCH V3]
> MdeModulePkg/BootManagerMenuApp: Limit string drawing within one line
> 
> I am ok for this change. Reviewed-by: Liming Gao
> <gaoliming@byosoft.com.cn>
> 
> > -----邮件原件-----
> > 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Gao,
> Zhichao
> > 发送时间: 2021年9月28日 13:18
> > 收件人: devel@edk2.groups.io; Gao, Zhichao <zhichao.gao@intel.com>
> > 抄送: Wang, Jian J <jian.j.wang@intel.com>; Liming Gao
> > <gaoliming@byosoft.com.cn>; Ni, Ray <ray.ni@intel.com>
> > 主题: Re: [edk2-devel] [PATCH V3]
> MdeModulePkg/BootManagerMenuApp:
> > Limit string drawing within one line
> >
> > Hi Liming/Ray,
> >
> > I have updated the commit message and the BZ comments. Do you agree
> to
> > merge the code?
> >
> > Thanks,
> > Zhichao
> >
> > > -----Original Message-----
> > > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Gao,
> > > Zhichao
> > > Sent: Monday, September 27, 2021 3:10 PM
> > > To: devel@edk2.groups.io
> > > Cc: Wang, Jian J <jian.j.wang@intel.com>; Liming Gao
> > > <gaoliming@byosoft.com.cn>; Ni, Ray <ray.ni@intel.com>
> > > Subject: [edk2-devel] [PATCH V3]
> MdeModulePkg/BootManagerMenuApp:
> > > Limit string drawing within one line
> > >
> > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3590
> > >
> > > Limit the draw box always within the screen's column and row.
> > > Limit the string drawing within one line.For the incompleted string
> > > the
> last 3
> > > characters in one line wouldbe replaced with "...".
> > >
> > > Cc: Jian J Wang <jian.j.wang@intel.com>
> > > Cc: Liming Gao <gaoliming@byosoft.com.cn>
> > > Cc: Ray Ni <ray.ni@intel.com>
> > > Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>Reviewed-by: Ray
> > > Ni <ray.ni@intel.com> ---V2:Drop the change in UefiBootManagerLib in
> > V1.Add
> > > the limitation in BootManagerMenuApp instead.V3:Update the commit
> > > message only.
> > >  .../BootManagerMenuApp/BootManagerMenu.c      | 72
> > > ++++++++++++++++++-
> > >  1 file changed, 69 insertions(+), 3 deletions(-)
> > >
> > > diff --git
> > >
> a/MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenu.
> > > c
> > >
> b/MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenu.
> > > c
> > > index 9e729074ec..d4bdeba073 100644
> > > ---
> > >
> a/MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenu.
> > > c
> > > +++
> > >
> b/MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenu.
> > > c
> > > @@ -1,7 +1,7 @@
> > >  /** @file   The application to show the Boot Manager Menu. -Copyright
> > (c)
> > > 2011 - 2018, Intel Corporation. All rights reserved.<BR>+Copyright
> > > (c)
> 2011 -
> > > 2021, Intel Corporation. All rights reserved.<BR>
> SPDX-License-Identifier:
> > > BSD-2-Clause-Patent  **/@@ -45,9 +45,56 @@ PrintStringAt (
> > >    IN CHAR16    *String   ) {+  UINTN         ScreenWidth;+
> > UINTN
> > > ScreenRows;+  CHAR16        *TurncateString;+  EFI_STATUS
> > Status;+  UINTN
> > > ShowingLength;    gST->ConOut->SetCursorPosition (gST->ConOut,
> > Column,
> > > Row);-  return Print (L"%s", String);++  gST->ConOut->QueryMode (+
> > > gST->ConOut,+                 gST->ConOut->Mode->Mode,+
> > > &ScreenWidth,+
> > &ScreenRows+                 );++  if (Column >
> > > (ScreenWidth - 1) || Row > (ScreenRows - 1)) {+    return 0;+  }++  if
> > ((StrLen
> > > (String) + Column) > (ScreenWidth - 1)) {+    //+    // |      -
> > ScreenWidth -       |+
> > > // ...Column.....................+    // TurncateString length should
> leave one
> > > character for draw box and+    // require one character for string end.+
> > //+
> > > ShowingLength = ScreenWidth - Column - 1;+    TurncateString =
> > AllocatePool
> > > ((ShowingLength + 1) * sizeof (CHAR16));++    if (TurncateString ==
> NULL)
> > {+
> > > return 0;+    }++    Status = StrnCpyS (TurncateString, ShowingLength +
> > 1,
> > > String, ShowingLength - 3);++    if (EFI_ERROR (Status)) {+
> FreePool
> > > (TurncateString);+      return 0;+    }++    *(TurncateString +
> > ShowingLength - 3)
> > > = L'.';+    *(TurncateString + ShowingLength - 2) = L'.';+
> > *(TurncateString +
> > > ShowingLength - 1) = L'.';+    *(TurncateString + ShowingLength)     =
> > L'\0';+
> > > ShowingLength = Print (L"%s", TurncateString);+    FreePool
> > > (TurncateString);+    return ShowingLength;+  } else {+    return Print
> > (L"%s",
> > > String);+  } }  /**@@ -68,7 +115,22 @@ PrintCharAt (
> > >    CHAR16       Character   ) {+  UINTN         ScreenWidth;+
> > UINTN
> > > ScreenRows;+   gST->ConOut->SetCursorPosition (gST->ConOut, Column,
> > > Row);++  gST->ConOut->QueryMode (+
> > gST->ConOut,+                 gST-
> > > >ConOut->Mode->Mode,+                 &ScreenWidth,+
> > > &ScreenRows+                 );++  if (Column > (ScreenWidth - 1) ||
> > Row >
> > > (ScreenRows - 1)) {+    return 0;+  }+   return Print (L"%c",
> Character); }
> > @@ -
> > > 193,7 +255,11 @@ InitializeBootMenuScreen (
> > >     MaxPrintRows = Row - 6;   UnSelectableItmes =
> > TITLE_TOKEN_COUNT + 2 +
> > > HELP_TOKEN_COUNT + 2;-  BootMenuData->MenuScreen.Width =
> > > MaxStrWidth + 8;+  if (MaxStrWidth + 8 > Column) {+    BootMenuData-
> > > >MenuScreen.Width = Column;+  } else {+    BootMenuData-
> > > >MenuScreen.Width = MaxStrWidth + 8;+  }   if
> > (BootMenuData->ItemCount
> > > + UnSelectableItmes > MaxPrintRows) {     BootMenuData-
> > > >MenuScreen.Height = MaxPrintRows;     BootMenuData-
> > > >ScrollBarControl.HasScrollBar = TRUE;--
> > > 2.31.1.windows.1
> > >
> > >
> > >
> > > -=-=-=-=-=-=
> > > Groups.io Links: You receive all messages sent to this group.
> > > View/Reply Online (#81153):
> > https://edk2.groups.io/g/devel/message/81153
> > > Mute This Topic: https://groups.io/mt/85895022/1768756
> > > Group Owner: devel+owner@edk2.groups.io
> > > Unsubscribe: https://edk2.groups.io/g/devel/unsub
> > [zhichao.gao@intel.com]
> > > -=-=-=-=-=-=
> > >
> >
> >
> >
> >
> >
> 
> 
> 
> 
> 
> 
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* 回复: [edk2-devel] [PATCH V3] MdeModulePkg/BootManagerMenuApp: Limit string drawing within one line
  2021-09-29  1:32     ` Gao, Zhichao
@ 2021-09-29  1:39       ` gaoliming
  0 siblings, 0 replies; 4+ messages in thread
From: gaoliming @ 2021-09-29  1:39 UTC (permalink / raw)
  To: devel, zhichao.gao; +Cc: 'Wang, Jian J', 'Ni, Ray'

I just merge it. 

Thanks
Liming
> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Gao, Zhichao
> 发送时间: 2021年9月29日 9:32
> 收件人: devel@edk2.groups.io; gaoliming@byosoft.com.cn
> 抄送: Wang, Jian J <jian.j.wang@intel.com>; Ni, Ray <ray.ni@intel.com>
> 主题: Re: [edk2-devel] [PATCH V3] MdeModulePkg/BootManagerMenuApp:
> Limit string drawing within one line
> 
> I have created the PR at: https://github.com/tianocore/edk2/pull/2019.
> It shows all the checks are passed. Can you help to add your 'push' label and
> reopen it?
> 
> Thanks,
> Zhichao
> 
> > -----Original Message-----
> > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of
> > gaoliming
> > Sent: Tuesday, September 28, 2021 1:27 PM
> > To: devel@edk2.groups.io; Gao, Zhichao <zhichao.gao@intel.com>
> > Cc: Wang, Jian J <jian.j.wang@intel.com>; Ni, Ray <ray.ni@intel.com>
> > Subject: 回复: [edk2-devel] [PATCH V3]
> > MdeModulePkg/BootManagerMenuApp: Limit string drawing within one
> line
> >
> > I am ok for this change. Reviewed-by: Liming Gao
> > <gaoliming@byosoft.com.cn>
> >
> > > -----邮件原件-----
> > > 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Gao,
> > Zhichao
> > > 发送时间: 2021年9月28日 13:18
> > > 收件人: devel@edk2.groups.io; Gao, Zhichao <zhichao.gao@intel.com>
> > > 抄送: Wang, Jian J <jian.j.wang@intel.com>; Liming Gao
> > > <gaoliming@byosoft.com.cn>; Ni, Ray <ray.ni@intel.com>
> > > 主题: Re: [edk2-devel] [PATCH V3]
> > MdeModulePkg/BootManagerMenuApp:
> > > Limit string drawing within one line
> > >
> > > Hi Liming/Ray,
> > >
> > > I have updated the commit message and the BZ comments. Do you agree
> > to
> > > merge the code?
> > >
> > > Thanks,
> > > Zhichao
> > >
> > > > -----Original Message-----
> > > > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of
> Gao,
> > > > Zhichao
> > > > Sent: Monday, September 27, 2021 3:10 PM
> > > > To: devel@edk2.groups.io
> > > > Cc: Wang, Jian J <jian.j.wang@intel.com>; Liming Gao
> > > > <gaoliming@byosoft.com.cn>; Ni, Ray <ray.ni@intel.com>
> > > > Subject: [edk2-devel] [PATCH V3]
> > MdeModulePkg/BootManagerMenuApp:
> > > > Limit string drawing within one line
> > > >
> > > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3590
> > > >
> > > > Limit the draw box always within the screen's column and row.
> > > > Limit the string drawing within one line.For the incompleted string
> > > > the
> > last 3
> > > > characters in one line wouldbe replaced with "...".
> > > >
> > > > Cc: Jian J Wang <jian.j.wang@intel.com>
> > > > Cc: Liming Gao <gaoliming@byosoft.com.cn>
> > > > Cc: Ray Ni <ray.ni@intel.com>
> > > > Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>Reviewed-by: Ray
> > > > Ni <ray.ni@intel.com> ---V2:Drop the change in UefiBootManagerLib in
> > > V1.Add
> > > > the limitation in BootManagerMenuApp instead.V3:Update the commit
> > > > message only.
> > > >  .../BootManagerMenuApp/BootManagerMenu.c      | 72
> > > > ++++++++++++++++++-
> > > >  1 file changed, 69 insertions(+), 3 deletions(-)
> > > >
> > > > diff --git
> > > >
> > a/MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenu.
> > > > c
> > > >
> > b/MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenu.
> > > > c
> > > > index 9e729074ec..d4bdeba073 100644
> > > > ---
> > > >
> > a/MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenu.
> > > > c
> > > > +++
> > > >
> > b/MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenu.
> > > > c
> > > > @@ -1,7 +1,7 @@
> > > >  /** @file   The application to show the Boot Manager Menu.
> -Copyright
> > > (c)
> > > > 2011 - 2018, Intel Corporation. All rights reserved.<BR>+Copyright
> > > > (c)
> > 2011 -
> > > > 2021, Intel Corporation. All rights reserved.<BR>
> > SPDX-License-Identifier:
> > > > BSD-2-Clause-Patent  **/@@ -45,9 +45,56 @@ PrintStringAt (
> > > >    IN CHAR16    *String   ) {+  UINTN         ScreenWidth;+
> > > UINTN
> > > > ScreenRows;+  CHAR16        *TurncateString;+  EFI_STATUS
> > > Status;+  UINTN
> > > > ShowingLength;    gST->ConOut->SetCursorPosition (gST->ConOut,
> > > Column,
> > > > Row);-  return Print (L"%s", String);++  gST->ConOut->QueryMode (+
> > > > gST->ConOut,+                 gST->ConOut->Mode->Mode,+
> > > > &ScreenWidth,+
> > > &ScreenRows+                 );++  if (Column >
> > > > (ScreenWidth - 1) || Row > (ScreenRows - 1)) {+    return 0;+  }++  if
> > > ((StrLen
> > > > (String) + Column) > (ScreenWidth - 1)) {+    //+    // |      -
> > > ScreenWidth -       |+
> > > > // ...Column.....................+    // TurncateString length should
> > leave one
> > > > character for draw box and+    // require one character for string
> end.+
> > > //+
> > > > ShowingLength = ScreenWidth - Column - 1;+    TurncateString =
> > > AllocatePool
> > > > ((ShowingLength + 1) * sizeof (CHAR16));++    if (TurncateString ==
> > NULL)
> > > {+
> > > > return 0;+    }++    Status = StrnCpyS (TurncateString,
> ShowingLength +
> > > 1,
> > > > String, ShowingLength - 3);++    if (EFI_ERROR (Status)) {+
> > FreePool
> > > > (TurncateString);+      return 0;+    }++    *(TurncateString +
> > > ShowingLength - 3)
> > > > = L'.';+    *(TurncateString + ShowingLength - 2) = L'.';+
> > > *(TurncateString +
> > > > ShowingLength - 1) = L'.';+    *(TurncateString + ShowingLength)
> =
> > > L'\0';+
> > > > ShowingLength = Print (L"%s", TurncateString);+    FreePool
> > > > (TurncateString);+    return ShowingLength;+  } else {+    return
> Print
> > > (L"%s",
> > > > String);+  } }  /**@@ -68,7 +115,22 @@ PrintCharAt (
> > > >    CHAR16       Character   ) {+  UINTN
> ScreenWidth;+
> > > UINTN
> > > > ScreenRows;+   gST->ConOut->SetCursorPosition (gST->ConOut,
> Column,
> > > > Row);++  gST->ConOut->QueryMode (+
> > > gST->ConOut,+                 gST-
> > > > >ConOut->Mode->Mode,+                 &ScreenWidth,+
> > > > &ScreenRows+                 );++  if (Column > (ScreenWidth - 1)
> ||
> > > Row >
> > > > (ScreenRows - 1)) {+    return 0;+  }+   return Print (L"%c",
> > Character); }
> > > @@ -
> > > > 193,7 +255,11 @@ InitializeBootMenuScreen (
> > > >     MaxPrintRows = Row - 6;   UnSelectableItmes =
> > > TITLE_TOKEN_COUNT + 2 +
> > > > HELP_TOKEN_COUNT + 2;-  BootMenuData->MenuScreen.Width =
> > > > MaxStrWidth + 8;+  if (MaxStrWidth + 8 > Column) {+
> BootMenuData-
> > > > >MenuScreen.Width = Column;+  } else {+    BootMenuData-
> > > > >MenuScreen.Width = MaxStrWidth + 8;+  }   if
> > > (BootMenuData->ItemCount
> > > > + UnSelectableItmes > MaxPrintRows) {     BootMenuData-
> > > > >MenuScreen.Height = MaxPrintRows;     BootMenuData-
> > > > >ScrollBarControl.HasScrollBar = TRUE;--
> > > > 2.31.1.windows.1
> > > >
> > > >
> > > >
> > > > -=-=-=-=-=-=
> > > > Groups.io Links: You receive all messages sent to this group.
> > > > View/Reply Online (#81153):
> > > https://edk2.groups.io/g/devel/message/81153
> > > > Mute This Topic: https://groups.io/mt/85895022/1768756
> > > > Group Owner: devel+owner@edk2.groups.io
> > > > Unsubscribe: https://edk2.groups.io/g/devel/unsub
> > > [zhichao.gao@intel.com]
> > > > -=-=-=-=-=-=
> > > >
> > >
> > >
> > >
> > >
> > >
> >
> >
> >
> >
> >
> >
> >
> 
> 
> 
> 
> 




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-09-29  1:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <16A89C34DEA6347B.26412@groups.io>
2021-09-28  5:17 ` [edk2-devel] [PATCH V3] MdeModulePkg/BootManagerMenuApp: Limit string drawing within one line Gao, Zhichao
2021-09-28  5:26   ` 回复: " gaoliming
2021-09-29  1:32     ` Gao, Zhichao
2021-09-29  1:39       ` 回复: " gaoliming

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox