mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-09-24 10:28:58 +02:00
Fix double clicking on border creates a new tab issue
Fix https://github.com/notepad-plus-plus/notepad-plus-plus/pull/16561#issuecomment-2938756492 Close #16755
This commit is contained in:
parent
884f8cdc06
commit
105a141a43
@ -3013,7 +3013,9 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
|||||||
|
|
||||||
case WM_LBUTTONDBLCLK:
|
case WM_LBUTTONDBLCLK:
|
||||||
{
|
{
|
||||||
::SendMessage(hwnd, WM_COMMAND, IDM_FILE_NEW, 0);
|
DocTabView* curTabView = (currentView() == MAIN_VIEW) ? &_mainDocTab : &_subDocTab;
|
||||||
|
::SendMessage(curTabView->getHSelf(), WM_LBUTTONDBLCLK, wParam, lParam);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -316,7 +316,7 @@ LRESULT SplitterContainer::runProc(UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
: (pt.y < 0 ? _pWin0 : _pWin1);
|
: (pt.y < 0 ? _pWin0 : _pWin1);
|
||||||
|
|
||||||
::SendMessage(parent, NPPM_INTERNAL_SWITCHVIEWFROMHWND, 0, reinterpret_cast<LPARAM>(targetWindow->getHSelf()));
|
::SendMessage(parent, NPPM_INTERNAL_SWITCHVIEWFROMHWND, 0, reinterpret_cast<LPARAM>(targetWindow->getHSelf()));
|
||||||
::SendMessage(parent, WM_COMMAND, IDM_FILE_NEW, 0);
|
::SendMessage(parent, WM_LBUTTONDBLCLK, wParam, lParam);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1175,14 +1175,35 @@ LRESULT TabBarPlus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPara
|
|||||||
|
|
||||||
case WM_LBUTTONDBLCLK:
|
case WM_LBUTTONDBLCLK:
|
||||||
{
|
{
|
||||||
bool isDbClk2Close = NppParameters::getInstance().getNppGUI()._tabStatus & TAB_DBCLK2CLOSE;
|
NppParameters& nppParam = NppParameters::getInstance();
|
||||||
if (isDbClk2Close)
|
NppGUI& nppGUI = nppParam.getNppGUI();
|
||||||
{
|
|
||||||
|
bool isVertical = nppGUI._tabStatus & TAB_VERTICAL;
|
||||||
|
bool isDbClk2Close = nppGUI._tabStatus & TAB_DBCLK2CLOSE;
|
||||||
|
|
||||||
int xPos = LOWORD(lParam);
|
int xPos = LOWORD(lParam);
|
||||||
int yPos = HIWORD(lParam);
|
int yPos = HIWORD(lParam);
|
||||||
int currentTabOn = getTabIndexAt(xPos, yPos);
|
int currentTabOn = getTabIndexAt(xPos, yPos);
|
||||||
|
|
||||||
|
if (currentTabOn != -1)
|
||||||
|
{
|
||||||
|
if (isDbClk2Close)
|
||||||
notify(TCN_TABDELETE, currentTabOn);
|
notify(TCN_TABDELETE, currentTabOn);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
POINT pt{};
|
||||||
|
GetCursorPos(&pt);
|
||||||
|
|
||||||
|
RECT rcLastTab{};
|
||||||
|
TabCtrl_GetItemRect(_hSelf, static_cast<int32_t>(TabCtrl_GetItemCount(_hSelf)) - 1, &rcLastTab);
|
||||||
|
ClientRectToScreenRect(_hSelf, &rcLastTab);
|
||||||
|
|
||||||
|
bool isDbClickOnTabStrip = isVertical ? (pt.x < rcLastTab.right) : (pt.y < rcLastTab.bottom);
|
||||||
|
if (isDbClickOnTabStrip)
|
||||||
|
::SendMessage(_hParent, WM_COMMAND, IDM_FILE_NEW, 0);
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user