From 0d98bd24f1a955b9fc8278a38dab0a8d1573bd8e Mon Sep 17 00:00:00 2001 From: Don HO Date: Wed, 16 Jul 2025 19:28:01 +0200 Subject: [PATCH] Fix -notabbar & asNotepad.xml stop hiding tabbar regression (from v8.7.9) The regression is due to the refactoring of tabbar: https://github.com/notepad-plus-plus/notepad-plus-plus/commit/ff734af115372eb3e6660c2891e55a914efb30bd Fix #16794, close #16825 --- PowerEditor/src/Notepad_plus_Window.cpp | 3 ++- PowerEditor/src/Parameters.cpp | 9 ++++++++- PowerEditor/src/Parameters.h | 1 + PowerEditor/src/WinControls/Preference/preferenceDlg.cpp | 6 ++++++ 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/PowerEditor/src/Notepad_plus_Window.cpp b/PowerEditor/src/Notepad_plus_Window.cpp index 0e6653680..5fe8e8e28 100644 --- a/PowerEditor/src/Notepad_plus_Window.cpp +++ b/PowerEditor/src/Notepad_plus_Window.cpp @@ -159,7 +159,8 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const wchar_t *cmdL if (cmdLineParams->_isNoTab) { // Restore old settings when tab bar has been hidden from tab bar. - nppGUI._tabStatus = tabStatusOld; + if (!(tabStatusOld & TAB_HIDE)) + nppGUI._forceTabbarVisible = true; } } diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index a1d8911fb..1b5ca5a6d 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -7364,7 +7364,14 @@ void NppParameters::createXmlTreeFromGUIParams() pStr = (_nppGUI._tabStatus & TAB_MULTILINE) ? L"yes" : L"no"; GUIConfigElement->SetAttribute(L"multiLine", pStr); - pStr = (_nppGUI._tabStatus & TAB_HIDE) ? L"yes" : L"no"; + if (_nppGUI._forceTabbarVisible) + { + pStr = L"no"; + } + else + { + pStr = (_nppGUI._tabStatus & TAB_HIDE) ? L"yes" : L"no"; + } GUIConfigElement->SetAttribute(L"hide", pStr); pStr = (_nppGUI._tabStatus & TAB_QUITONEMPTY) ? L"yes" : L"no"; diff --git a/PowerEditor/src/Parameters.h b/PowerEditor/src/Parameters.h index 5bdd09365..284427816 100644 --- a/PowerEditor/src/Parameters.h +++ b/PowerEditor/src/Parameters.h @@ -848,6 +848,7 @@ struct NppGUI final bool _menuBarShow = true; int _tabStatus = (TAB_DRAWTOPBAR | TAB_DRAWINACTIVETAB | TAB_DRAGNDROP | TAB_REDUCE | TAB_CLOSEBUTTON | TAB_PINBUTTON); + bool _forceTabbarVisible = false; bool _splitterPos = POS_VERTICAL; int _userDefineDlgStatus = UDD_DOCKED; diff --git a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp index 9fbaf8387..53f3d2cd5 100644 --- a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp +++ b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp @@ -1260,6 +1260,12 @@ intptr_t CALLBACK TabbarSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM ::SendMessage(::GetParent(_hParent), WM_SIZE, 0, 0); + // At startup, if "-notabbar" or "asNotepad.xml" is used, and tab bar was not hidden in the previous session, + // we force tab bar visible in the next session by setting _forceTabbarVisible to true. + // However, if "Hide tab bar" option is changed manually by user, then we don't force tab bar visible for the next session, + // and apply user's choice instead. + nppGUI._forceTabbarVisible = false; + return TRUE; }