diff --git a/src/propsheet/OptionsPage.cpp b/src/propsheet/OptionsPage.cpp index 8ce4a638af1..27561a4fdd4 100644 --- a/src/propsheet/OptionsPage.cpp +++ b/src/propsheet/OptionsPage.cpp @@ -3,6 +3,30 @@ #include "precomp.h" +void InitializeCursorSize(const HWND hOptionsDlg) +{ + unsigned int newRadioValue = IDD_CURSOR_ADVANCED; + if (gpStateInfo->CursorType != 0) + { + // IDD_CURSOR_ADVANCED is used as a placeholder for when a + // non-legacy shape is selected. + newRadioValue = IDD_CURSOR_ADVANCED; + } + else if (gpStateInfo->CursorSize <= 25) + { + newRadioValue = IDD_CURSOR_SMALL; + } + else if (gpStateInfo->CursorSize <= 50) + { + newRadioValue = IDD_CURSOR_MEDIUM; + } + else + { + newRadioValue = IDD_CURSOR_LARGE; + } + CheckRadioButton(hOptionsDlg, IDD_CURSOR_SMALL, IDD_CURSOR_ADVANCED, newRadioValue); +} + bool OptionsCommandCallback(HWND hDlg, const unsigned int Item, const unsigned int Notification, HWND hControlWindow) { UINT Value; @@ -147,6 +171,9 @@ INT_PTR WINAPI SettingsDlgProc(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM lPara switch (wMsg) { case WM_INITDIALOG: + // Initialize the global handle to this dialog + g_hOptionsDlg = hDlg; + CheckDlgButton(hDlg, IDD_HISTORY_NODUP, gpStateInfo->HistoryNoDup); CheckDlgButton(hDlg, IDD_QUICKEDIT, gpStateInfo->QuickEdit); CheckDlgButton(hDlg, IDD_INSERT, gpStateInfo->InsertMode); @@ -167,19 +194,7 @@ INT_PTR WINAPI SettingsDlgProc(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM lPara CreateAndAssociateToolTipToControl(IDD_INTERCEPT_COPY_PASTE, hDlg, IDS_TOOLTIP_INTERCEPT_COPY_PASTE); // initialize cursor radio buttons - if (gpStateInfo->CursorSize <= 25) - { - Item = IDD_CURSOR_SMALL; - } - else if (gpStateInfo->CursorSize <= 50) - { - Item = IDD_CURSOR_MEDIUM; - } - else - { - Item = IDD_CURSOR_LARGE; - } - CheckRadioButton(hDlg, IDD_CURSOR_SMALL, IDD_CURSOR_LARGE, Item); + InitializeCursorSize(hDlg); SetDlgItemInt(hDlg, IDD_HISTORY_SIZE, gpStateInfo->HistoryBufferSize, FALSE); SendDlgItemMessage(hDlg, IDD_HISTORY_SIZE, EM_LIMITTEXT, 3, 0); diff --git a/src/propsheet/OptionsPage.h b/src/propsheet/OptionsPage.h index 21ab26cbe63..d09f1003711 100644 --- a/src/propsheet/OptionsPage.h +++ b/src/propsheet/OptionsPage.h @@ -6,7 +6,7 @@ Module Name: - OptionsPage.h Abstract: -- This module contains the definitions for console options dialog. +- This module contains the definitions for console options dialog. Author(s): Mike Griese (migrie) Oct-2016 @@ -16,3 +16,4 @@ Author(s): void ToggleV2OptionsControls(__in const HWND hDlg); INT_PTR WINAPI SettingsDlgProc(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM lParam); +void InitializeCursorSize(const HWND hOptionsDlg); diff --git a/src/propsheet/TerminalPage.cpp b/src/propsheet/TerminalPage.cpp index f7e5b0a9dbc..5f645399494 100644 --- a/src/propsheet/TerminalPage.cpp +++ b/src/propsheet/TerminalPage.cpp @@ -3,6 +3,7 @@ #include "precomp.h" #include "TerminalPage.h" +#include "OptionsPage.h" // For InitializeCursorSize #include "ColorControl.h" #include @@ -323,10 +324,22 @@ bool TerminalDlgCommand(const HWND hDlg, const WORD item, const WORD command) no case IDD_TERMINAL_UNDERSCORE: case IDD_TERMINAL_EMPTYBOX: case IDD_TERMINAL_SOLIDBOX: + { gpStateInfo->CursorType = item - IDD_TERMINAL_LEGACY_CURSOR; UpdateApplyButton(hDlg); + + // See GH#1219 - When the cursor state is something other than legacy, + // we need to manually check the "IDD_CURSOR_ADVANCED" radio button on + // the Options page. This will prevent the Options page from manually + // resetting the cursor to legacy. + if (g_hOptionsDlg != INVALID_HANDLE_VALUE) + { + InitializeCursorSize(g_hOptionsDlg); + } + handled = true; break; + } case IDD_DISABLE_SCROLLFORWARD: gpStateInfo->TerminalScrolling = IsDlgButtonChecked(hDlg, IDD_DISABLE_SCROLLFORWARD); UpdateApplyButton(hDlg); diff --git a/src/propsheet/console.rc b/src/propsheet/console.rc index 8ab505a6ede..dd7bc9df01e 100644 --- a/src/propsheet/console.rc +++ b/src/propsheet/console.rc @@ -42,6 +42,8 @@ BEGIN WS_TABSTOP | WS_GROUP AUTORADIOBUTTON "&Medium", IDD_CURSOR_MEDIUM, 14, 33, 84, 10, AUTORADIOBUTTON "&Large", IDD_CURSOR_LARGE, 14, 43, 84, 10, + // IDD_CURSOR_ADVANCED is a hidden control, see GH#1219 + AUTORADIOBUTTON "", IDD_CURSOR_ADVANCED, 14, 53, 0, 0, GROUPBOX "Command History", -1, 115, 11, 120, 56, WS_GROUP LTEXT "&Buffer Size:", -1, 119, 25, 78, 9 @@ -106,6 +108,8 @@ BEGIN WS_TABSTOP | WS_GROUP AUTORADIOBUTTON "&Medium", IDD_CURSOR_MEDIUM, 14, 33, 84, 10, AUTORADIOBUTTON "&Large", IDD_CURSOR_LARGE, 14, 43, 84, 10, + // IDD_CURSOR_ADVANCED is a hidden control, see GH#1219 + AUTORADIOBUTTON "", IDD_CURSOR_ADVANCED, 14, 53, 0, 0, GROUPBOX "Command History", -1, 115, 11, 120, 56, WS_GROUP LTEXT "&Buffer Size:", -1, 119, 25, 78, 9 diff --git a/src/propsheet/dialogs.h b/src/propsheet/dialogs.h index 763aff876ce..952e2ff9a08 100644 --- a/src/propsheet/dialogs.h +++ b/src/propsheet/dialogs.h @@ -43,6 +43,7 @@ Revision History: #define IDD_LANGUAGE_GROUPBOX 116 #define DID_SETTINGS_COMCTL5 117 #define DID_SETTINGS2_COMCTL5 118 +#define IDD_CURSOR_ADVANCED 119 #define DID_FONTDLG 200 #define IDD_STATIC 201 diff --git a/src/propsheet/globals.cpp b/src/propsheet/globals.cpp index a47b0d4bf24..b7c59171cc9 100644 --- a/src/propsheet/globals.cpp +++ b/src/propsheet/globals.cpp @@ -55,3 +55,4 @@ COLORREF g_fakeBackgroundColor = RGB(12, 12, 12); // Default black COLORREF g_fakeCursorColor = RGB(242, 242, 242); // Default bright white HWND g_hTerminalDlg = static_cast(INVALID_HANDLE_VALUE); +HWND g_hOptionsDlg = static_cast(INVALID_HANDLE_VALUE); diff --git a/src/propsheet/globals.h b/src/propsheet/globals.h index 8a75fb1acc1..0d1b2adfc84 100644 --- a/src/propsheet/globals.h +++ b/src/propsheet/globals.h @@ -53,3 +53,4 @@ extern COLORREF g_fakeBackgroundColor; extern COLORREF g_fakeCursorColor; extern HWND g_hTerminalDlg; +extern HWND g_hOptionsDlg;