* [PATCH V2] MdeModulePkg/BootManagerMenuApp: Limit string drawing within one line @ 2021-09-09 7:25 Gao, Zhichao 2021-09-09 14:54 ` Ni, Ray 2021-09-22 3:27 ` Ni, Ray 0 siblings, 2 replies; 13+ messages in thread From: Gao, Zhichao @ 2021-09-09 7:25 UTC (permalink / raw) To: devel; +Cc: Jian J Wang, Liming Gao, Ray Ni 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. Change-Id: Ib7bd63cb07b23875a1e4f37ae80a422e1d5ed54f 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> --- V2: Drop the change in UefiBootManagerLib in V1. Add the limitation in BootManagerMenuApp instead. .../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 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH V2] MdeModulePkg/BootManagerMenuApp: Limit string drawing within one line 2021-09-09 7:25 [PATCH V2] MdeModulePkg/BootManagerMenuApp: Limit string drawing within one line Gao, Zhichao @ 2021-09-09 14:54 ` Ni, Ray 2021-09-10 6:20 ` Gao, Zhichao [not found] ` <16A361A200435518.18571@groups.io> 2021-09-22 3:27 ` Ni, Ray 1 sibling, 2 replies; 13+ messages in thread From: Ni, Ray @ 2021-09-09 14:54 UTC (permalink / raw) To: Gao, Zhichao, Bi, Dandan; +Cc: Wang, Jian J, Liming Gao, devel@edk2.groups.io I remember that HII can tell the width of a string. Have you evaluated using HII? +@Bi, Dandan > -----Original Message----- > From: Gao, Zhichao <zhichao.gao@intel.com> > Sent: Thursday, September 9, 2021 3:26 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: [PATCH V2] 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. > > Change-Id: Ib7bd63cb07b23875a1e4f37ae80a422e1d5ed54f > 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> > --- > > V2: > > Drop the change in UefiBootManagerLib in V1. > > Add the limitation in BootManagerMenuApp instead. > > > .../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 ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH V2] MdeModulePkg/BootManagerMenuApp: Limit string drawing within one line 2021-09-09 14:54 ` Ni, Ray @ 2021-09-10 6:20 ` Gao, Zhichao [not found] ` <16A361A200435518.18571@groups.io> 1 sibling, 0 replies; 13+ messages in thread From: Gao, Zhichao @ 2021-09-10 6:20 UTC (permalink / raw) To: Ni, Ray, Bi, Dandan; +Cc: Wang, Jian J, Liming Gao, devel@edk2.groups.io No. My point is the HII usage would require the HII browser engine. That's too complex for this simple app. Dandan, If I am wrong, please help to correct. Thanks, Zhichao > -----Original Message----- > From: Ni, Ray <ray.ni@intel.com> > Sent: Thursday, September 9, 2021 10:55 PM > To: Gao, Zhichao <zhichao.gao@intel.com>; Bi, Dandan > <dandan.bi@intel.com> > Cc: Wang, Jian J <jian.j.wang@intel.com>; Liming Gao > <gaoliming@byosoft.com.cn>; devel@edk2.groups.io > Subject: RE: [PATCH V2] MdeModulePkg/BootManagerMenuApp: Limit > string drawing within one line > > I remember that HII can tell the width of a string. > Have you evaluated using HII? +@Bi, Dandan > > > -----Original Message----- > > From: Gao, Zhichao <zhichao.gao@intel.com> > > Sent: Thursday, September 9, 2021 3:26 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: [PATCH V2] 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. > > > > Change-Id: Ib7bd63cb07b23875a1e4f37ae80a422e1d5ed54f > > 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> > > --- > > > > V2: > > > > Drop the change in UefiBootManagerLib in V1. > > > > Add the limitation in BootManagerMenuApp instead. > > > > > > .../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 ^ permalink raw reply [flat|nested] 13+ messages in thread
[parent not found: <16A361A200435518.18571@groups.io>]
* Re: [edk2-devel] [PATCH V2] MdeModulePkg/BootManagerMenuApp: Limit string drawing within one line [not found] ` <16A361A200435518.18571@groups.io> @ 2021-09-22 1:00 ` Gao, Zhichao 0 siblings, 0 replies; 13+ messages in thread From: Gao, Zhichao @ 2021-09-22 1:00 UTC (permalink / raw) To: devel@edk2.groups.io, Gao, Zhichao, Ni, Ray, Bi, Dandan Cc: Wang, Jian J, Liming Gao Can we make a decision on this issue? Thanks, Zhichao > -----Original Message----- > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Gao, > Zhichao > Sent: Friday, September 10, 2021 2:20 PM > To: Ni, Ray <ray.ni@intel.com>; Bi, Dandan <dandan.bi@intel.com> > Cc: Wang, Jian J <jian.j.wang@intel.com>; Liming Gao > <gaoliming@byosoft.com.cn>; devel@edk2.groups.io > Subject: Re: [edk2-devel] [PATCH V2] > MdeModulePkg/BootManagerMenuApp: Limit string drawing within one line > > No. My point is the HII usage would require the HII browser engine. That's > too complex for this simple app. > > Dandan, > If I am wrong, please help to correct. > > Thanks, > Zhichao > > > -----Original Message----- > > From: Ni, Ray <ray.ni@intel.com> > > Sent: Thursday, September 9, 2021 10:55 PM > > To: Gao, Zhichao <zhichao.gao@intel.com>; Bi, Dandan > > <dandan.bi@intel.com> > > Cc: Wang, Jian J <jian.j.wang@intel.com>; Liming Gao > > <gaoliming@byosoft.com.cn>; devel@edk2.groups.io > > Subject: RE: [PATCH V2] MdeModulePkg/BootManagerMenuApp: Limit > string > > drawing within one line > > > > I remember that HII can tell the width of a string. > > Have you evaluated using HII? +@Bi, Dandan > > > > > -----Original Message----- > > > From: Gao, Zhichao <zhichao.gao@intel.com> > > > Sent: Thursday, September 9, 2021 3:26 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: [PATCH V2] 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. > > > > > > Change-Id: Ib7bd63cb07b23875a1e4f37ae80a422e1d5ed54f > > > 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> > > > --- > > > > > > V2: > > > > > > Drop the change in UefiBootManagerLib in V1. > > > > > > Add the limitation in BootManagerMenuApp instead. > > > > > > > > > .../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 > > > > > > ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH V2] MdeModulePkg/BootManagerMenuApp: Limit string drawing within one line 2021-09-09 7:25 [PATCH V2] MdeModulePkg/BootManagerMenuApp: Limit string drawing within one line Gao, Zhichao 2021-09-09 14:54 ` Ni, Ray @ 2021-09-22 3:27 ` Ni, Ray 2021-09-22 4:49 ` Gao, Zhichao 1 sibling, 1 reply; 13+ messages in thread From: Ni, Ray @ 2021-09-22 3:27 UTC (permalink / raw) To: Gao, Zhichao, devel@edk2.groups.io; +Cc: Wang, Jian J, Liming Gao Reviewed-by: Ray Ni <ray.ni@intel.com> -----Original Message----- From: Gao, Zhichao <zhichao.gao@intel.com> Sent: Thursday, September 9, 2021 3:26 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: [PATCH V2] 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. Change-Id: Ib7bd63cb07b23875a1e4f37ae80a422e1d5ed54f 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> --- V2: Drop the change in UefiBootManagerLib in V1. Add the limitation in BootManagerMenuApp instead. .../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 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH V2] MdeModulePkg/BootManagerMenuApp: Limit string drawing within one line 2021-09-22 3:27 ` Ni, Ray @ 2021-09-22 4:49 ` Gao, Zhichao 2021-09-23 2:59 ` 回复: [edk2-devel] " gaoliming 0 siblings, 1 reply; 13+ messages in thread From: Gao, Zhichao @ 2021-09-22 4:49 UTC (permalink / raw) To: Ni, Ray, devel@edk2.groups.io, Liming Gao; +Cc: Wang, Jian J Hi Liming, The solution is different with the first time we discussed on the Bugzilla. Can you review if it is OK to you? Thanks, Zhichao > -----Original Message----- > From: Ni, Ray <ray.ni@intel.com> > Sent: Wednesday, September 22, 2021 11:28 AM > To: Gao, Zhichao <zhichao.gao@intel.com>; devel@edk2.groups.io > Cc: Wang, Jian J <jian.j.wang@intel.com>; Liming Gao > <gaoliming@byosoft.com.cn> > Subject: RE: [PATCH V2] MdeModulePkg/BootManagerMenuApp: Limit > string drawing within one line > > Reviewed-by: Ray Ni <ray.ni@intel.com> > > -----Original Message----- > From: Gao, Zhichao <zhichao.gao@intel.com> > Sent: Thursday, September 9, 2021 3:26 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: [PATCH V2] 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. > > Change-Id: Ib7bd63cb07b23875a1e4f37ae80a422e1d5ed54f > 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> > --- > > V2: > > Drop the change in UefiBootManagerLib in V1. > > Add the limitation in BootManagerMenuApp instead. > > > .../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 ^ permalink raw reply [flat|nested] 13+ messages in thread
* 回复: [edk2-devel] [PATCH V2] MdeModulePkg/BootManagerMenuApp: Limit string drawing within one line 2021-09-22 4:49 ` Gao, Zhichao @ 2021-09-23 2:59 ` gaoliming 2021-09-23 3:46 ` Gao, Zhichao [not found] ` <16A756C7FFB49908.14001@groups.io> 0 siblings, 2 replies; 13+ messages in thread From: gaoliming @ 2021-09-23 2:59 UTC (permalink / raw) To: devel, zhichao.gao, 'Ni, Ray'; +Cc: 'Wang, Jian J' Zhichao: With this change, the same boot option will be displayed differently in BootManagerApp and BootManager Page. Is it the designed behavior? Besides, please remove change-id from the commit message. Thanks Liming > -----邮件原件----- > 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Gao, Zhichao > 发送时间: 2021年9月22日 12:50 > 收件人: Ni, Ray <ray.ni@intel.com>; devel@edk2.groups.io; Liming Gao > <gaoliming@byosoft.com.cn> > 抄送: Wang, Jian J <jian.j.wang@intel.com> > 主题: Re: [edk2-devel] [PATCH V2] MdeModulePkg/BootManagerMenuApp: > Limit string drawing within one line > > Hi Liming, > > The solution is different with the first time we discussed on the Bugzilla. Can > you review if it is OK to you? > > Thanks, > Zhichao > > > -----Original Message----- > > From: Ni, Ray <ray.ni@intel.com> > > Sent: Wednesday, September 22, 2021 11:28 AM > > To: Gao, Zhichao <zhichao.gao@intel.com>; devel@edk2.groups.io > > Cc: Wang, Jian J <jian.j.wang@intel.com>; Liming Gao > > <gaoliming@byosoft.com.cn> > > Subject: RE: [PATCH V2] MdeModulePkg/BootManagerMenuApp: Limit > > string drawing within one line > > > > Reviewed-by: Ray Ni <ray.ni@intel.com> > > > > -----Original Message----- > > From: Gao, Zhichao <zhichao.gao@intel.com> > > Sent: Thursday, September 9, 2021 3:26 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: [PATCH V2] 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. > > > > Change-Id: Ib7bd63cb07b23875a1e4f37ae80a422e1d5ed54f > > 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> > > --- > > > > V2: > > > > Drop the change in UefiBootManagerLib in V1. > > > > Add the limitation in BootManagerMenuApp instead. > > > > > > .../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 > > > > > ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [edk2-devel] [PATCH V2] MdeModulePkg/BootManagerMenuApp: Limit string drawing within one line 2021-09-23 2:59 ` 回复: [edk2-devel] " gaoliming @ 2021-09-23 3:46 ` Gao, Zhichao 2021-09-23 7:42 ` Ni, Ray [not found] ` <16A756C7FFB49908.14001@groups.io> 1 sibling, 1 reply; 13+ messages in thread From: Gao, Zhichao @ 2021-09-23 3:46 UTC (permalink / raw) To: devel@edk2.groups.io, gaoliming@byosoft.com.cn, Ni, Ray; +Cc: Wang, Jian J Hi Liming, Yes. Because the design of the BM app is not aimed to display the boot option over one line. And it is not using the setup browser engine. That would cause the difference. If we want to make them align, there are two options: 1. BM app to use the setup browser engine 2. add scroll bar logic for the boot item Both above change is not simple and may cause new issues. It would be a new design other than a bug fix. Another solution is the patch V1 to limit the boot option description within 72 characters. Ray pointed out it is not a good solution. BTW, I would remove the change-id in next patch. Thanks, Zhichao > -----Original Message----- > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of > gaoliming > Sent: Thursday, September 23, 2021 10:59 AM > To: devel@edk2.groups.io; Gao, Zhichao <zhichao.gao@intel.com>; Ni, Ray > <ray.ni@intel.com> > Cc: Wang, Jian J <jian.j.wang@intel.com> > Subject: 回复: [edk2-devel] [PATCH V2] > MdeModulePkg/BootManagerMenuApp: Limit string drawing within one line > > Zhichao: > With this change, the same boot option will be displayed differently in > BootManagerApp and BootManager Page. Is it the designed behavior? > > Besides, please remove change-id from the commit message. > > Thanks > Liming > > -----邮件原件----- > > 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Gao, > Zhichao > > 发送时间: 2021年9月22日 12:50 > > 收件人: Ni, Ray <ray.ni@intel.com>; devel@edk2.groups.io; Liming Gao > > <gaoliming@byosoft.com.cn> > > 抄送: Wang, Jian J <jian.j.wang@intel.com> > > 主题: Re: [edk2-devel] [PATCH V2] > MdeModulePkg/BootManagerMenuApp: > > Limit string drawing within one line > > > > Hi Liming, > > > > The solution is different with the first time we discussed on the > Bugzilla. Can > > you review if it is OK to you? > > > > Thanks, > > Zhichao > > > > > -----Original Message----- > > > From: Ni, Ray <ray.ni@intel.com> > > > Sent: Wednesday, September 22, 2021 11:28 AM > > > To: Gao, Zhichao <zhichao.gao@intel.com>; devel@edk2.groups.io > > > Cc: Wang, Jian J <jian.j.wang@intel.com>; Liming Gao > > > <gaoliming@byosoft.com.cn> > > > Subject: RE: [PATCH V2] MdeModulePkg/BootManagerMenuApp: Limit > > > string drawing within one line > > > > > > Reviewed-by: Ray Ni <ray.ni@intel.com> > > > > > > -----Original Message----- > > > From: Gao, Zhichao <zhichao.gao@intel.com> > > > Sent: Thursday, September 9, 2021 3:26 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: [PATCH V2] 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. > > > > > > Change-Id: Ib7bd63cb07b23875a1e4f37ae80a422e1d5ed54f > > > 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> > > > --- > > > > > > V2: > > > > > > Drop the change in UefiBootManagerLib in V1. > > > > > > Add the limitation in BootManagerMenuApp instead. > > > > > > > > > .../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 > > > > > > > > > > > > > > > > > ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [edk2-devel] [PATCH V2] MdeModulePkg/BootManagerMenuApp: Limit string drawing within one line 2021-09-23 3:46 ` Gao, Zhichao @ 2021-09-23 7:42 ` Ni, Ray 2021-09-23 8:21 ` Gao, Zhichao 0 siblings, 1 reply; 13+ messages in thread From: Ni, Ray @ 2021-09-23 7:42 UTC (permalink / raw) To: Gao, Zhichao, devel@edk2.groups.io, gaoliming@byosoft.com.cn; +Cc: Wang, Jian J Another option is to use EfiBootManagerRegisterBootDescriptionHandler() to alter the boot descriptions. > -----Original Message----- > From: Gao, Zhichao <zhichao.gao@intel.com> > Sent: Thursday, September 23, 2021 11:47 AM > To: devel@edk2.groups.io; gaoliming@byosoft.com.cn; Ni, Ray <ray.ni@intel.com> > Cc: Wang, Jian J <jian.j.wang@intel.com> > Subject: RE: [edk2-devel] [PATCH V2] MdeModulePkg/BootManagerMenuApp: Limit string drawing within one line > > Hi Liming, > > Yes. Because the design of the BM app is not aimed to display the boot option over one line. And it is not using the setup > browser engine. > That would cause the difference. > If we want to make them align, there are two options: > 1. BM app to use the setup browser engine > 2. add scroll bar logic for the boot item > > Both above change is not simple and may cause new issues. It would be a new design other than a bug fix. > > Another solution is the patch V1 to limit the boot option description within 72 characters. Ray pointed out it is not a good > solution. > > BTW, I would remove the change-id in next patch. > > Thanks, > Zhichao > > > -----Original Message----- > > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of > > gaoliming > > Sent: Thursday, September 23, 2021 10:59 AM > > To: devel@edk2.groups.io; Gao, Zhichao <zhichao.gao@intel.com>; Ni, Ray > > <ray.ni@intel.com> > > Cc: Wang, Jian J <jian.j.wang@intel.com> > > Subject: 回复: [edk2-devel] [PATCH V2] > > MdeModulePkg/BootManagerMenuApp: Limit string drawing within one line > > > > Zhichao: > > With this change, the same boot option will be displayed differently in > > BootManagerApp and BootManager Page. Is it the designed behavior? > > > > Besides, please remove change-id from the commit message. > > > > Thanks > > Liming > > > -----邮件原件----- > > > 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Gao, > > Zhichao > > > 发送时间: 2021年9月22日 12:50 > > > 收件人: Ni, Ray <ray.ni@intel.com>; devel@edk2.groups.io; Liming Gao > > > <gaoliming@byosoft.com.cn> > > > 抄送: Wang, Jian J <jian.j.wang@intel.com> > > > 主题: Re: [edk2-devel] [PATCH V2] > > MdeModulePkg/BootManagerMenuApp: > > > Limit string drawing within one line > > > > > > Hi Liming, > > > > > > The solution is different with the first time we discussed on the > > Bugzilla. Can > > > you review if it is OK to you? > > > > > > Thanks, > > > Zhichao > > > > > > > -----Original Message----- > > > > From: Ni, Ray <ray.ni@intel.com> > > > > Sent: Wednesday, September 22, 2021 11:28 AM > > > > To: Gao, Zhichao <zhichao.gao@intel.com>; devel@edk2.groups.io > > > > Cc: Wang, Jian J <jian.j.wang@intel.com>; Liming Gao > > > > <gaoliming@byosoft.com.cn> > > > > Subject: RE: [PATCH V2] MdeModulePkg/BootManagerMenuApp: Limit > > > > string drawing within one line > > > > > > > > Reviewed-by: Ray Ni <ray.ni@intel.com> > > > > > > > > -----Original Message----- > > > > From: Gao, Zhichao <zhichao.gao@intel.com> > > > > Sent: Thursday, September 9, 2021 3:26 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: [PATCH V2] 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. > > > > > > > > Change-Id: Ib7bd63cb07b23875a1e4f37ae80a422e1d5ed54f > > > > 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> > > > > --- > > > > > > > > V2: > > > > > > > > Drop the change in UefiBootManagerLib in V1. > > > > > > > > Add the limitation in BootManagerMenuApp instead. > > > > > > > > > > > > .../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 > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [edk2-devel] [PATCH V2] MdeModulePkg/BootManagerMenuApp: Limit string drawing within one line 2021-09-23 7:42 ` Ni, Ray @ 2021-09-23 8:21 ` Gao, Zhichao 2021-09-24 1:28 ` Ni, Ray 0 siblings, 1 reply; 13+ messages in thread From: Gao, Zhichao @ 2021-09-23 8:21 UTC (permalink / raw) To: Ni, Ray, devel@edk2.groups.io, gaoliming@byosoft.com.cn; +Cc: Wang, Jian J Hi Ray, That is one way for platform to customize their own boot option. It can solve the issue. But my point is it should not be used in such case. If EDK2 want a default behavior of the boot option description, we should change at the root instead of using the customize interfaces. Thanks, Zhichao > -----Original Message----- > From: Ni, Ray <ray.ni@intel.com> > Sent: Thursday, September 23, 2021 3:43 PM > To: Gao, Zhichao <zhichao.gao@intel.com>; devel@edk2.groups.io; > gaoliming@byosoft.com.cn > Cc: Wang, Jian J <jian.j.wang@intel.com> > Subject: RE: [edk2-devel] [PATCH V2] > MdeModulePkg/BootManagerMenuApp: Limit string drawing within one line > > Another option is to use EfiBootManagerRegisterBootDescriptionHandler() > to alter the boot descriptions. > > > -----Original Message----- > > From: Gao, Zhichao <zhichao.gao@intel.com> > > Sent: Thursday, September 23, 2021 11:47 AM > > To: devel@edk2.groups.io; gaoliming@byosoft.com.cn; Ni, Ray > > <ray.ni@intel.com> > > Cc: Wang, Jian J <jian.j.wang@intel.com> > > Subject: RE: [edk2-devel] [PATCH V2] > MdeModulePkg/BootManagerMenuApp: > > Limit string drawing within one line > > > > Hi Liming, > > > > Yes. Because the design of the BM app is not aimed to display the boot > > option over one line. And it is not using the setup browser engine. > > That would cause the difference. > > If we want to make them align, there are two options: > > 1. BM app to use the setup browser engine 2. add scroll bar logic for > > the boot item > > > > Both above change is not simple and may cause new issues. It would be a > new design other than a bug fix. > > > > Another solution is the patch V1 to limit the boot option description > > within 72 characters. Ray pointed out it is not a good solution. > > > > BTW, I would remove the change-id in next patch. > > > > Thanks, > > Zhichao > > > > > -----Original Message----- > > > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of > > > gaoliming > > > Sent: Thursday, September 23, 2021 10:59 AM > > > To: devel@edk2.groups.io; Gao, Zhichao <zhichao.gao@intel.com>; Ni, > > > Ray <ray.ni@intel.com> > > > Cc: Wang, Jian J <jian.j.wang@intel.com> > > > Subject: 回复: [edk2-devel] [PATCH V2] > > > MdeModulePkg/BootManagerMenuApp: Limit string drawing within one > > > line > > > > > > Zhichao: > > > With this change, the same boot option will be displayed > > > differently in BootManagerApp and BootManager Page. Is it the designed > behavior? > > > > > > Besides, please remove change-id from the commit message. > > > > > > Thanks > > > Liming > > > > -----邮件原件----- > > > > 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Gao, > > > Zhichao > > > > 发送时间: 2021年9月22日 12:50 > > > > 收件人: Ni, Ray <ray.ni@intel.com>; devel@edk2.groups.io; Liming Gao > > > > <gaoliming@byosoft.com.cn> > > > > 抄送: Wang, Jian J <jian.j.wang@intel.com> > > > > 主题: Re: [edk2-devel] [PATCH V2] > > > MdeModulePkg/BootManagerMenuApp: > > > > Limit string drawing within one line > > > > > > > > Hi Liming, > > > > > > > > The solution is different with the first time we discussed on the > > > Bugzilla. Can > > > > you review if it is OK to you? > > > > > > > > Thanks, > > > > Zhichao > > > > > > > > > -----Original Message----- > > > > > From: Ni, Ray <ray.ni@intel.com> > > > > > Sent: Wednesday, September 22, 2021 11:28 AM > > > > > To: Gao, Zhichao <zhichao.gao@intel.com>; devel@edk2.groups.io > > > > > Cc: Wang, Jian J <jian.j.wang@intel.com>; Liming Gao > > > > > <gaoliming@byosoft.com.cn> > > > > > Subject: RE: [PATCH V2] MdeModulePkg/BootManagerMenuApp: > Limit > > > > > string drawing within one line > > > > > > > > > > Reviewed-by: Ray Ni <ray.ni@intel.com> > > > > > > > > > > -----Original Message----- > > > > > From: Gao, Zhichao <zhichao.gao@intel.com> > > > > > Sent: Thursday, September 9, 2021 3:26 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: [PATCH V2] 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. > > > > > > > > > > Change-Id: Ib7bd63cb07b23875a1e4f37ae80a422e1d5ed54f > > > > > 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> > > > > > --- > > > > > > > > > > V2: > > > > > > > > > > Drop the change in UefiBootManagerLib in V1. > > > > > > > > > > Add the limitation in BootManagerMenuApp instead. > > > > > > > > > > > > > > > .../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 > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [edk2-devel] [PATCH V2] MdeModulePkg/BootManagerMenuApp: Limit string drawing within one line 2021-09-23 8:21 ` Gao, Zhichao @ 2021-09-24 1:28 ` Ni, Ray 0 siblings, 0 replies; 13+ messages in thread From: Ni, Ray @ 2021-09-24 1:28 UTC (permalink / raw) To: Gao, Zhichao, devel@edk2.groups.io, gaoliming@byosoft.com.cn; +Cc: Wang, Jian J Limiting the boot description to a fixed number of characters should be a platform policy. BDS common logic should NOT do that. Imagine a platform that contains a fancy UI with scrollbar or supports a big resolution. Such platform can still use the BdsDxe driver. But it doesn't need the BootManagerMenuApp. > -----Original Message----- > From: Gao, Zhichao <zhichao.gao@intel.com> > Sent: Thursday, September 23, 2021 4:22 PM > To: Ni, Ray <ray.ni@intel.com>; devel@edk2.groups.io; gaoliming@byosoft.com.cn > Cc: Wang, Jian J <jian.j.wang@intel.com> > Subject: RE: [edk2-devel] [PATCH V2] MdeModulePkg/BootManagerMenuApp: Limit string drawing within one line > > Hi Ray, > That is one way for platform to customize their own boot option. It can solve the issue. But my point is it should not be used in > such case. If EDK2 want a default behavior of the boot option description, we should change at the root instead of using the > customize interfaces. > > Thanks, > Zhichao > > > -----Original Message----- > > From: Ni, Ray <ray.ni@intel.com> > > Sent: Thursday, September 23, 2021 3:43 PM > > To: Gao, Zhichao <zhichao.gao@intel.com>; devel@edk2.groups.io; > > gaoliming@byosoft.com.cn > > Cc: Wang, Jian J <jian.j.wang@intel.com> > > Subject: RE: [edk2-devel] [PATCH V2] > > MdeModulePkg/BootManagerMenuApp: Limit string drawing within one line > > > > Another option is to use EfiBootManagerRegisterBootDescriptionHandler() > > to alter the boot descriptions. > > > > > -----Original Message----- > > > From: Gao, Zhichao <zhichao.gao@intel.com> > > > Sent: Thursday, September 23, 2021 11:47 AM > > > To: devel@edk2.groups.io; gaoliming@byosoft.com.cn; Ni, Ray > > > <ray.ni@intel.com> > > > Cc: Wang, Jian J <jian.j.wang@intel.com> > > > Subject: RE: [edk2-devel] [PATCH V2] > > MdeModulePkg/BootManagerMenuApp: > > > Limit string drawing within one line > > > > > > Hi Liming, > > > > > > Yes. Because the design of the BM app is not aimed to display the boot > > > option over one line. And it is not using the setup browser engine. > > > That would cause the difference. > > > If we want to make them align, there are two options: > > > 1. BM app to use the setup browser engine 2. add scroll bar logic for > > > the boot item > > > > > > Both above change is not simple and may cause new issues. It would be a > > new design other than a bug fix. > > > > > > Another solution is the patch V1 to limit the boot option description > > > within 72 characters. Ray pointed out it is not a good solution. > > > > > > BTW, I would remove the change-id in next patch. > > > > > > Thanks, > > > Zhichao > > > > > > > -----Original Message----- > > > > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of > > > > gaoliming > > > > Sent: Thursday, September 23, 2021 10:59 AM > > > > To: devel@edk2.groups.io; Gao, Zhichao <zhichao.gao@intel.com>; Ni, > > > > Ray <ray.ni@intel.com> > > > > Cc: Wang, Jian J <jian.j.wang@intel.com> > > > > Subject: 回复: [edk2-devel] [PATCH V2] > > > > MdeModulePkg/BootManagerMenuApp: Limit string drawing within one > > > > line > > > > > > > > Zhichao: > > > > With this change, the same boot option will be displayed > > > > differently in BootManagerApp and BootManager Page. Is it the designed > > behavior? > > > > > > > > Besides, please remove change-id from the commit message. > > > > > > > > Thanks > > > > Liming > > > > > -----邮件原件----- > > > > > 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Gao, > > > > Zhichao > > > > > 发送时间: 2021年9月22日 12:50 > > > > > 收件人: Ni, Ray <ray.ni@intel.com>; devel@edk2.groups.io; Liming Gao > > > > > <gaoliming@byosoft.com.cn> > > > > > 抄送: Wang, Jian J <jian.j.wang@intel.com> > > > > > 主题: Re: [edk2-devel] [PATCH V2] > > > > MdeModulePkg/BootManagerMenuApp: > > > > > Limit string drawing within one line > > > > > > > > > > Hi Liming, > > > > > > > > > > The solution is different with the first time we discussed on the > > > > Bugzilla. Can > > > > > you review if it is OK to you? > > > > > > > > > > Thanks, > > > > > Zhichao > > > > > > > > > > > -----Original Message----- > > > > > > From: Ni, Ray <ray.ni@intel.com> > > > > > > Sent: Wednesday, September 22, 2021 11:28 AM > > > > > > To: Gao, Zhichao <zhichao.gao@intel.com>; devel@edk2.groups.io > > > > > > Cc: Wang, Jian J <jian.j.wang@intel.com>; Liming Gao > > > > > > <gaoliming@byosoft.com.cn> > > > > > > Subject: RE: [PATCH V2] MdeModulePkg/BootManagerMenuApp: > > Limit > > > > > > string drawing within one line > > > > > > > > > > > > Reviewed-by: Ray Ni <ray.ni@intel.com> > > > > > > > > > > > > -----Original Message----- > > > > > > From: Gao, Zhichao <zhichao.gao@intel.com> > > > > > > Sent: Thursday, September 9, 2021 3:26 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: [PATCH V2] 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. > > > > > > > > > > > > Change-Id: Ib7bd63cb07b23875a1e4f37ae80a422e1d5ed54f > > > > > > 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> > > > > > > --- > > > > > > > > > > > > V2: > > > > > > > > > > > > Drop the change in UefiBootManagerLib in V1. > > > > > > > > > > > > Add the limitation in BootManagerMenuApp instead. > > > > > > > > > > > > > > > > > > .../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 > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ^ permalink raw reply [flat|nested] 13+ messages in thread
[parent not found: <16A756C7FFB49908.14001@groups.io>]
* Re: [edk2-devel] [PATCH V2] MdeModulePkg/BootManagerMenuApp: Limit string drawing within one line [not found] ` <16A756C7FFB49908.14001@groups.io> @ 2021-09-24 6:15 ` Gao, Zhichao 2021-09-26 1:00 ` 回复: " gaoliming 0 siblings, 1 reply; 13+ messages in thread From: Gao, Zhichao @ 2021-09-24 6:15 UTC (permalink / raw) To: devel@edk2.groups.io, Gao, Zhichao, gaoliming@byosoft.com.cn, Ni, Ray Cc: Wang, Jian J Hi Liming, One more info I forgot to mention, the patch would make the long boot option string show within one line with "..." at the end of the string. Which indicate the boot description is not completed. Thanks, Zhichao > -----Original Message----- > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Gao, > Zhichao > Sent: Thursday, September 23, 2021 11:47 AM > To: devel@edk2.groups.io; gaoliming@byosoft.com.cn; Ni, Ray > <ray.ni@intel.com> > Cc: Wang, Jian J <jian.j.wang@intel.com> > Subject: Re: [edk2-devel] [PATCH V2] > MdeModulePkg/BootManagerMenuApp: Limit string drawing within one line > > Hi Liming, > > Yes. Because the design of the BM app is not aimed to display the boot > option over one line. And it is not using the setup browser engine. > That would cause the difference. > If we want to make them align, there are two options: > 1. BM app to use the setup browser engine 2. add scroll bar logic for the boot > item > > Both above change is not simple and may cause new issues. It would be a > new design other than a bug fix. > > Another solution is the patch V1 to limit the boot option description within 72 > characters. Ray pointed out it is not a good solution. > > BTW, I would remove the change-id in next patch. > > Thanks, > Zhichao > > > -----Original Message----- > > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of > > gaoliming > > Sent: Thursday, September 23, 2021 10:59 AM > > To: devel@edk2.groups.io; Gao, Zhichao <zhichao.gao@intel.com>; Ni, > > Ray <ray.ni@intel.com> > > Cc: Wang, Jian J <jian.j.wang@intel.com> > > Subject: 回复: [edk2-devel] [PATCH V2] > > MdeModulePkg/BootManagerMenuApp: Limit string drawing within one > line > > > > Zhichao: > > With this change, the same boot option will be displayed differently > > in BootManagerApp and BootManager Page. Is it the designed behavior? > > > > Besides, please remove change-id from the commit message. > > > > Thanks > > Liming > > > -----邮件原件----- > > > 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Gao, > > Zhichao > > > 发送时间: 2021年9月22日 12:50 > > > 收件人: Ni, Ray <ray.ni@intel.com>; devel@edk2.groups.io; Liming Gao > > > <gaoliming@byosoft.com.cn> > > > 抄送: Wang, Jian J <jian.j.wang@intel.com> > > > 主题: Re: [edk2-devel] [PATCH V2] > > MdeModulePkg/BootManagerMenuApp: > > > Limit string drawing within one line > > > > > > Hi Liming, > > > > > > The solution is different with the first time we discussed on the > > Bugzilla. Can > > > you review if it is OK to you? > > > > > > Thanks, > > > Zhichao > > > > > > > -----Original Message----- > > > > From: Ni, Ray <ray.ni@intel.com> > > > > Sent: Wednesday, September 22, 2021 11:28 AM > > > > To: Gao, Zhichao <zhichao.gao@intel.com>; devel@edk2.groups.io > > > > Cc: Wang, Jian J <jian.j.wang@intel.com>; Liming Gao > > > > <gaoliming@byosoft.com.cn> > > > > Subject: RE: [PATCH V2] MdeModulePkg/BootManagerMenuApp: Limit > > > > string drawing within one line > > > > > > > > Reviewed-by: Ray Ni <ray.ni@intel.com> > > > > > > > > -----Original Message----- > > > > From: Gao, Zhichao <zhichao.gao@intel.com> > > > > Sent: Thursday, September 9, 2021 3:26 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: [PATCH V2] 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. > > > > > > > > Change-Id: Ib7bd63cb07b23875a1e4f37ae80a422e1d5ed54f > > > > 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> > > > > --- > > > > > > > > V2: > > > > > > > > Drop the change in UefiBootManagerLib in V1. > > > > > > > > Add the limitation in BootManagerMenuApp instead. > > > > > > > > > > > > .../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 > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ^ permalink raw reply [flat|nested] 13+ messages in thread
* 回复: [edk2-devel] [PATCH V2] MdeModulePkg/BootManagerMenuApp: Limit string drawing within one line 2021-09-24 6:15 ` Gao, Zhichao @ 2021-09-26 1:00 ` gaoliming 0 siblings, 0 replies; 13+ messages in thread From: gaoliming @ 2021-09-26 1:00 UTC (permalink / raw) To: 'Gao, Zhichao', devel, 'Ni, Ray'; +Cc: 'Wang, Jian J' Zhichao: I am OK to use "..." as the end of string. I suggest to add the comments to explain the different behavior for BootManagerMenuApp and BootManagerUiLib in BZ. Thanks Liming > -----邮件原件----- > 发件人: Gao, Zhichao <zhichao.gao@intel.com> > 发送时间: 2021年9月24日 14:16 > 收件人: devel@edk2.groups.io; Gao, Zhichao <zhichao.gao@intel.com>; > gaoliming@byosoft.com.cn; Ni, Ray <ray.ni@intel.com> > 抄送: Wang, Jian J <jian.j.wang@intel.com> > 主题: RE: [edk2-devel] [PATCH V2] MdeModulePkg/BootManagerMenuApp: > Limit string drawing within one line > > Hi Liming, > > One more info I forgot to mention, the patch would make the long boot option > string show within one line with "..." at the end of the string. Which indicate > the boot description is not completed. > > Thanks, > Zhichao > > > -----Original Message----- > > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Gao, > > Zhichao > > Sent: Thursday, September 23, 2021 11:47 AM > > To: devel@edk2.groups.io; gaoliming@byosoft.com.cn; Ni, Ray > > <ray.ni@intel.com> > > Cc: Wang, Jian J <jian.j.wang@intel.com> > > Subject: Re: [edk2-devel] [PATCH V2] > > MdeModulePkg/BootManagerMenuApp: Limit string drawing within one > line > > > > Hi Liming, > > > > Yes. Because the design of the BM app is not aimed to display the boot > > option over one line. And it is not using the setup browser engine. > > That would cause the difference. > > If we want to make them align, there are two options: > > 1. BM app to use the setup browser engine 2. add scroll bar logic for the > boot > > item > > > > Both above change is not simple and may cause new issues. It would be a > > new design other than a bug fix. > > > > Another solution is the patch V1 to limit the boot option description within > 72 > > characters. Ray pointed out it is not a good solution. > > > > BTW, I would remove the change-id in next patch. > > > > Thanks, > > Zhichao > > > > > -----Original Message----- > > > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of > > > gaoliming > > > Sent: Thursday, September 23, 2021 10:59 AM > > > To: devel@edk2.groups.io; Gao, Zhichao <zhichao.gao@intel.com>; Ni, > > > Ray <ray.ni@intel.com> > > > Cc: Wang, Jian J <jian.j.wang@intel.com> > > > Subject: 回复: [edk2-devel] [PATCH V2] > > > MdeModulePkg/BootManagerMenuApp: Limit string drawing within one > > line > > > > > > Zhichao: > > > With this change, the same boot option will be displayed differently > > > in BootManagerApp and BootManager Page. Is it the designed behavior? > > > > > > Besides, please remove change-id from the commit message. > > > > > > Thanks > > > Liming > > > > -----邮件原件----- > > > > 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Gao, > > > Zhichao > > > > 发送时间: 2021年9月22日 12:50 > > > > 收件人: Ni, Ray <ray.ni@intel.com>; devel@edk2.groups.io; Liming Gao > > > > <gaoliming@byosoft.com.cn> > > > > 抄送: Wang, Jian J <jian.j.wang@intel.com> > > > > 主题: Re: [edk2-devel] [PATCH V2] > > > MdeModulePkg/BootManagerMenuApp: > > > > Limit string drawing within one line > > > > > > > > Hi Liming, > > > > > > > > The solution is different with the first time we discussed on the > > > Bugzilla. Can > > > > you review if it is OK to you? > > > > > > > > Thanks, > > > > Zhichao > > > > > > > > > -----Original Message----- > > > > > From: Ni, Ray <ray.ni@intel.com> > > > > > Sent: Wednesday, September 22, 2021 11:28 AM > > > > > To: Gao, Zhichao <zhichao.gao@intel.com>; devel@edk2.groups.io > > > > > Cc: Wang, Jian J <jian.j.wang@intel.com>; Liming Gao > > > > > <gaoliming@byosoft.com.cn> > > > > > Subject: RE: [PATCH V2] MdeModulePkg/BootManagerMenuApp: > Limit > > > > > string drawing within one line > > > > > > > > > > Reviewed-by: Ray Ni <ray.ni@intel.com> > > > > > > > > > > -----Original Message----- > > > > > From: Gao, Zhichao <zhichao.gao@intel.com> > > > > > Sent: Thursday, September 9, 2021 3:26 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: [PATCH V2] 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. > > > > > > > > > > Change-Id: Ib7bd63cb07b23875a1e4f37ae80a422e1d5ed54f > > > > > 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> > > > > > --- > > > > > > > > > > V2: > > > > > > > > > > Drop the change in UefiBootManagerLib in V1. > > > > > > > > > > Add the limitation in BootManagerMenuApp instead. > > > > > > > > > > > > > > > .../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 > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2021-09-26 1:00 UTC | newest] Thread overview: 13+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2021-09-09 7:25 [PATCH V2] MdeModulePkg/BootManagerMenuApp: Limit string drawing within one line Gao, Zhichao 2021-09-09 14:54 ` Ni, Ray 2021-09-10 6:20 ` Gao, Zhichao [not found] ` <16A361A200435518.18571@groups.io> 2021-09-22 1:00 ` [edk2-devel] " Gao, Zhichao 2021-09-22 3:27 ` Ni, Ray 2021-09-22 4:49 ` Gao, Zhichao 2021-09-23 2:59 ` 回复: [edk2-devel] " gaoliming 2021-09-23 3:46 ` Gao, Zhichao 2021-09-23 7:42 ` Ni, Ray 2021-09-23 8:21 ` Gao, Zhichao 2021-09-24 1:28 ` Ni, Ray [not found] ` <16A756C7FFB49908.14001@groups.io> 2021-09-24 6:15 ` Gao, Zhichao 2021-09-26 1:00 ` 回复: " gaoliming
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox