From nobody Tue Apr 30 12:15:16 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zoho.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1493021549815524.0104069248025; Mon, 24 Apr 2017 01:12:29 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 6517D2195407F; Mon, 24 Apr 2017 01:12:20 -0700 (PDT) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id B12672195407C for ; Mon, 24 Apr 2017 01:12:19 -0700 (PDT) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Apr 2017 01:12:19 -0700 Received: from shwdeopenpsi114.ccr.corp.intel.com ([10.239.157.135]) by fmsmga004.fm.intel.com with ESMTP; 24 Apr 2017 01:12:18 -0700 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,243,1488873600"; d="scan'208";a="252681237" From: Dandan Bi To: edk2-devel@lists.01.org Date: Mon, 24 Apr 2017 16:11:28 +0800 Message-Id: <1493021488-201704-1-git-send-email-dandan.bi@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 Subject: [edk2] [patch] MdemodulePkg/DisplayEngine: clean the line before showing message X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eric Dong MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Cc: Eric Dong Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi --- .../CustomizedDisplayLibInternal.c | 21 ++++++++---------= ---- .../Universal/DisplayEngineDxe/FormDisplay.c | 15 +++++++-------- 2 files changed, 15 insertions(+), 21 deletions(-) diff --git a/MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib= Internal.c b/MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib= Internal.c index bc14a9d..3e24f35 100644 --- a/MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLibInterna= l.c +++ b/MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLibInterna= l.c @@ -857,12 +857,10 @@ PrintInternal ( CHAR16 *BackupBuffer; UINTN Index; UINTN PreviousIndex; UINTN Count; UINTN TotalCount; - UINTN PrintWidth; - UINTN CharWidth; =20 // // For now, allocate an arbitrarily long buffer // Buffer =3D AllocateZeroPool (0x10000); @@ -882,12 +880,18 @@ PrintInternal ( =20 Index =3D 0; PreviousIndex =3D 0; Count =3D 0; TotalCount =3D 0; - PrintWidth =3D 0; - CharWidth =3D 1; + + // + // Clean the line and then reset the position of the cursor. + // + Out->OutputString (Out, &mSpaceBuffer[SPACE_BUFFER_SIZE - Width]); + if (Column !=3D (UINTN) -1) { + Out->SetCursorPosition (Out, Column, Row); + } =20 do { for (; (Buffer[Index] !=3D NARROW_CHAR) && (Buffer[Index] !=3D WIDE_CH= AR) && (Buffer[Index] !=3D 0); Index++) { BackupBuffer[Index] =3D Buffer[Index]; } @@ -899,11 +903,10 @@ PrintInternal ( // // Print this out, we are about to switch widths // Out->OutputString (Out, &BackupBuffer[PreviousIndex]); Count =3D StrLen (&BackupBuffer[PreviousIndex]); - PrintWidth +=3D Count * CharWidth; TotalCount +=3D Count; =20 // // Preserve the current index + 1, since this is where we will start p= rinting from next // @@ -916,18 +919,16 @@ PrintInternal ( // // Preserve bits 0 - 6 and zero out the rest // Out->Mode->Attribute =3D Out->Mode->Attribute & 0x7f; Out->SetAttribute (Out, Out->Mode->Attribute); - CharWidth =3D 1; } else { // // Must be wide, set bit 7 ON // Out->Mode->Attribute =3D Out->Mode->Attribute | EFI_WIDE_ATTRIBUTE; Out->SetAttribute (Out, Out->Mode->Attribute); - CharWidth =3D 2; } =20 Index++; =20 } while (Buffer[Index] !=3D 0); @@ -935,17 +936,11 @@ PrintInternal ( // // We hit the end of the string - print it // Out->OutputString (Out, &BackupBuffer[PreviousIndex]); Count =3D StrLen (&BackupBuffer[PreviousIndex]); - PrintWidth +=3D Count * CharWidth; TotalCount +=3D Count; - if (PrintWidth < Width) { - Out->Mode->Attribute =3D Out->Mode->Attribute & 0x7f; - Out->SetAttribute (Out, Out->Mode->Attribute); - Out->OutputString (Out, &mSpaceBuffer[SPACE_BUFFER_SIZE - Width + Prin= tWidth]); - } =20 FreePool (Buffer); FreePool (BackupBuffer); return TotalCount; } diff --git a/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c b/MdeMod= ulePkg/Universal/DisplayEngineDxe/FormDisplay.c index e1ac5a3..2938351 100644 --- a/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c +++ b/MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c @@ -2056,32 +2056,31 @@ DisplayMenuString ( IN CHAR16 *String, IN UINTN Width, IN BOOLEAN Highlight ) { - UINTN Length; - // // Print string with normal color. // if (!Highlight) { PrintStringAtWithWidth (Col, Row, String, Width); return; } - =20 // // Print the highlight menu string. - // First print the highlight string. + // First, clean the line. //=20 + PrintStringAtWithWidth (Col, Row, L"", Width); + // + // Second, set the display attribute for highlight string and then print= it. + // SetDisplayAttribute(MenuOption, TRUE); - Length =3D PrintStringAt (Col, Row, String); - + PrintStringAt (Col, Row, String); // - // Second, clean the empty after the string. + // Last, reset the display attribute. // SetDisplayAttribute(MenuOption, FALSE); - PrintStringAtWithWidth (Col + Length, Row, L"", Width - Length); } =20 /** Check whether this menu can has option string. =20 --=20 1.9.5.msysgit.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel