Replace macros with constexpr part 2 (#3416)
This commit is contained in:
parent
15505337d8
commit
de9231a88b
|
@ -955,7 +955,7 @@ void CommandLine::_deleteCommandHistory(COOKED_READ_DATA& cookedReadData) noexce
|
|||
if (cookedReadData.HasHistory())
|
||||
{
|
||||
cookedReadData.History().Empty();
|
||||
cookedReadData.History().Flags |= CLE_ALLOCATED;
|
||||
cookedReadData.History().Flags |= CommandHistory::CLE_ALLOCATED;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,13 +12,13 @@ Abstract:
|
|||
|
||||
#pragma once
|
||||
|
||||
// CommandHistory Flags
|
||||
#define CLE_ALLOCATED 0x00000001
|
||||
#define CLE_RESET 0x00000002
|
||||
|
||||
class CommandHistory
|
||||
{
|
||||
public:
|
||||
// CommandHistory Flags
|
||||
static constexpr int CLE_ALLOCATED = 0x00000001;
|
||||
static constexpr int CLE_RESET = 0x00000002;
|
||||
|
||||
static CommandHistory* s_Allocate(const std::wstring_view appName, const HANDLE processHandle);
|
||||
static CommandHistory* s_Find(const HANDLE processHandle);
|
||||
static CommandHistory* s_FindByExe(const std::wstring_view appName);
|
||||
|
|
|
@ -28,9 +28,9 @@ Revision History:
|
|||
|
||||
// indicates how much to change the opacity at each mouse/key toggle
|
||||
// Opacity is defined as 0-255. 12 is therefore approximately 5% per tick.
|
||||
#define OPACITY_DELTA_INTERVAL 12
|
||||
constexpr unsigned short OPACITY_DELTA_INTERVAL = 12;
|
||||
|
||||
#define MAX_CHARS_FROM_1_KEYSTROKE 6
|
||||
constexpr unsigned short MAX_CHARS_FROM_1_KEYSTROKE = 6;
|
||||
|
||||
#define KEY_TRANSITION_UP 0x80000000
|
||||
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
|
||||
#pragma hdrstop
|
||||
|
||||
#define DEFAULT_NUMBER_OF_COMMANDS 25
|
||||
#define DEFAULT_NUMBER_OF_BUFFERS 4
|
||||
constexpr unsigned int DEFAULT_NUMBER_OF_COMMANDS = 25;
|
||||
constexpr unsigned int DEFAULT_NUMBER_OF_BUFFERS = 4;
|
||||
|
||||
using Microsoft::Console::Interactivity::ServiceLocator;
|
||||
|
||||
|
|
|
@ -51,12 +51,12 @@ class HistoryTests
|
|||
const auto history = CommandHistory::s_Allocate(app, handle);
|
||||
VERIFY_IS_NOT_NULL(history);
|
||||
|
||||
VERIFY_IS_TRUE(WI_IsFlagSet(history->Flags, CLE_ALLOCATED));
|
||||
VERIFY_IS_TRUE(WI_IsFlagSet(history->Flags, CommandHistory::CLE_ALLOCATED));
|
||||
VERIFY_ARE_EQUAL(1ul, CommandHistory::s_historyLists.size());
|
||||
|
||||
CommandHistory::s_Free(handle);
|
||||
// We preserve the app history list for re-use if it reattaches in this session and doesn't age out.
|
||||
VERIFY_IS_TRUE(WI_IsFlagClear(history->Flags, CLE_ALLOCATED), L"Shouldn't actually be gone, just deallocated.");
|
||||
VERIFY_IS_TRUE(WI_IsFlagClear(history->Flags, CommandHistory::CLE_ALLOCATED), L"Shouldn't actually be gone, just deallocated.");
|
||||
VERIFY_ARE_EQUAL(1ul, CommandHistory::s_historyLists.size());
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ public:
|
|||
static void InitHistory(CommandHistory& history) noexcept
|
||||
{
|
||||
history.Empty();
|
||||
history.Flags |= CLE_ALLOCATED;
|
||||
history.Flags |= CommandHistory::CLE_ALLOCATED;
|
||||
VERIFY_SUCCEEDED(history.Add(L"I'm a little teapot", false));
|
||||
VERIFY_SUCCEEDED(history.Add(L"hear me shout", false));
|
||||
VERIFY_SUCCEEDED(history.Add(L"here is my handle", false));
|
||||
|
@ -50,7 +50,7 @@ public:
|
|||
static void InitLongHistory(CommandHistory& history) noexcept
|
||||
{
|
||||
history.Empty();
|
||||
history.Flags |= CLE_ALLOCATED;
|
||||
history.Flags |= CommandHistory::CLE_ALLOCATED;
|
||||
VERIFY_SUCCEEDED(history.Add(L"Because I could not stop for Death", false));
|
||||
VERIFY_SUCCEEDED(history.Add(L"He kindly stopped for me", false));
|
||||
VERIFY_SUCCEEDED(history.Add(L"The carriage held but just Ourselves", false));
|
||||
|
|
|
@ -22,10 +22,10 @@ Revision History:
|
|||
|
||||
#pragma once
|
||||
|
||||
#define CONIME_ATTRCOLOR_SIZE 8
|
||||
constexpr unsigned short CONIME_ATTRCOLOR_SIZE = 8;
|
||||
|
||||
#define CONIME_CURSOR_RIGHT 0x10
|
||||
#define CONIME_CURSOR_LEFT 0x20
|
||||
constexpr BYTE CONIME_CURSOR_RIGHT = 0x10;
|
||||
constexpr BYTE CONIME_CURSOR_LEFT = 0x20;
|
||||
|
||||
[[nodiscard]] HRESULT ImeStartComposition();
|
||||
|
||||
|
|
|
@ -91,11 +91,11 @@ Notes:
|
|||
{
|
||||
if (CompCursorPos == 0)
|
||||
{
|
||||
encodedAttrs[CompCursorPos] |= (BYTE)CONIME_CURSOR_LEFT; // special handling for ConSrv... 0x20 = COMMON_LVB_GRID_SINGLEFLAG + COMMON_LVB_GRID_LVERTICAL
|
||||
encodedAttrs[CompCursorPos] |= CONIME_CURSOR_LEFT; // special handling for ConSrv... 0x20 = COMMON_LVB_GRID_SINGLEFLAG + COMMON_LVB_GRID_LVERTICAL
|
||||
}
|
||||
else if (CompCursorPos - 1 < DisplayAttributes.size())
|
||||
{
|
||||
encodedAttrs[CompCursorPos - 1] |= (BYTE)CONIME_CURSOR_RIGHT; // special handling for ConSrv... 0x10 = COMMON_LVB_GRID_SINGLEFLAG + COMMON_LVB_GRID_RVERTICAL
|
||||
encodedAttrs[CompCursorPos - 1] |= CONIME_CURSOR_RIGHT; // special handling for ConSrv... 0x10 = COMMON_LVB_GRID_SINGLEFLAG + COMMON_LVB_GRID_RVERTICAL
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue