Fix -notabbar & asNotepad.xml stop hiding tabbar regression (from v8.7.9)

The regression is due to the refactoring of tabbar:
ff734af115

Fix #16794, close #16825
This commit is contained in:
Don HO 2025-07-16 19:28:01 +02:00
parent f897972070
commit 0d98bd24f1
4 changed files with 17 additions and 2 deletions

View File

@ -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;
}
}

View File

@ -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";

View File

@ -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;

View File

@ -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;
}