From 17e59b3346b7486fabbc57a13ef5b8c98d25a5a5 Mon Sep 17 00:00:00 2001 From: Jaben Carsey Date: Fri, 25 Jul 2014 18:46:23 +0000 Subject: ShellPkg: Fix calls to SimpleTextOut->SetAttribute to not use reserved bits As the shell inverts foreground and background it needs to be sure that it properly masks off the reserved bits and this is important since the foreground and background are not the same numbers of bits. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jaben Carsey Reviewed-by: Tapan Shah Reviewed-by: Erik Bjorge git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15681 6f19259b-4bc3-4df7-8a09-765794883524 --- ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'ShellPkg/Library/UefiShellDebug1CommandsLib/Edit') diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.c index 897700bd34..ed23365363 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.c @@ -301,8 +301,8 @@ FileBufferRestoreMousePosition ( // Orig = MainEditor.ColorAttributes; New.Data = 0; - New.Colors.Foreground = Orig.Colors.Background; - New.Colors.Background = Orig.Colors.Foreground; + New.Colors.Foreground = Orig.Colors.Background & 0xF; + New.Colors.Background = Orig.Colors.Foreground & 0x7; // // clear the old mouse position @@ -343,7 +343,7 @@ FileBufferRestoreMousePosition ( // // set the new mouse position // - gST->ConOut->SetAttribute (gST->ConOut, New.Data); + gST->ConOut->SetAttribute (gST->ConOut, New.Data & 0x7F); // // clear the old mouse position -- cgit v1.2.3