Repository: microsoft/terminal (language: cpp)

Issue:
Command History (F7) is added to when selected command from the list
### Windows Terminal version

1.20.11781.0

### Windows build number

10.0.22631.4037

### Other Software

_No response_

### Steps to reproduce

1. Open a clean command prompt - nothing in the list in F7.
2. Type in a command, e.g. "dir"
3. Type in a second different command, e.g. "dir D*"
4. Press F7 to see the command list - it will contain two commands. Select the first one from the list.
5. Press F7 to see the command list again, it will now contain three commands. This is unexpected. 

### Expected Behavior

Selecting the command from the command list was previously (in Windows 10 command prompt) the way you issued it to ensure it didn't get added to the history, thus allowing you to maintain a nice tidy command list.

### Actual Behavior

Instead it was added to the history.


Discussion / hints:

Fix patch:
diff --git a/src/host/settings.cpp b/src/host/settings.cpp
index e2dd84b78e7..0df97dbd354 100644
--- a/src/host/settings.cpp
+++ b/src/host/settings.cpp
@@ -36,7 +36,7 @@ Settings::Settings() :
     _bAutoPosition(true),
     _uHistoryBufferSize(DEFAULT_NUMBER_OF_COMMANDS),
     _uNumberOfHistoryBuffers(DEFAULT_NUMBER_OF_BUFFERS),
-    _bHistoryNoDup(false),
+    _bHistoryNoDup(true),
     // ColorTable initialized below
     _uCodePage(ServiceLocator::LocateGlobals().uiOEMCP),
     _uScrollScale(1),
@@ -110,7 +110,7 @@ void Settings::ApplyDesktopSpecificDefaults()
     _bQuickEdit = TRUE;
     _uHistoryBufferSize = 50;
     _uNumberOfHistoryBuffers = 4;
-    _bHistoryNoDup = FALSE;
+    _bHistoryNoDup = true;
 
     _renderSettings.ResetColorTable();
 
diff --git a/src/propsheet/registry.cpp b/src/propsheet/registry.cpp
index 64d392aa76d..3a7283e080e 100644
--- a/src/propsheet/registry.cpp
+++ b/src/propsheet/registry.cpp
@@ -79,7 +79,7 @@ VOID InitRegistryValues(
     pStateInfo->CursorSize = 25;
     pStateInfo->HistoryBufferSize = 25;
     pStateInfo->NumberOfHistoryBuffers = 4;
-    pStateInfo->HistoryNoDup = 0;
+    pStateInfo->HistoryNoDup = 1;
 
     // clang-format off
     if (pStateInfo->fIsV2Console)


Test patch: