Fix click on tab close file issue

How to reproduce the bug:
If the current tab size is smaller then next tab, click on 'x' button to close current tab, then next tab replces the closed tab position. Without move cursor and click on the next tab (now it becomes current tab), clicked tab is closed.

Fixed:
This bug is due to the current tab's information is not updated between 2 clicks.
Update the current hover tab RECT (_currentHoverTabRect) and close hover flag (_isCloseHover), so that x will be highlighted or not based on new _currentHoverTabRect.

Fixes #3004, closes #3340
This commit is contained in:
SinghRajenM 2017-06-01 22:50:14 +05:30 committed by Don HO
parent d2f8ccce1b
commit 164e2c6738
1 changed files with 11 additions and 0 deletions

View File

@ -775,6 +775,17 @@ LRESULT TabBarPlus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPara
{ {
notify(TCN_TABDELETE, currentTabOn); notify(TCN_TABDELETE, currentTabOn);
_whichCloseClickDown = -1; _whichCloseClickDown = -1;
// Get the next tab at same position
// If valid tab is found then
// update the current hover tab RECT (_currentHoverTabRect)
// update close hover flag (_isCloseHover), so that x will be highlighted or not based on new _currentHoverTabRect
int nextTab = getTabIndexAt(xPos, yPos);
if (nextTab != -1)
{
::SendMessage(_hSelf, TCM_GETITEMRECT, nextTab, reinterpret_cast<LPARAM>(&_currentHoverTabRect));
_isCloseHover = _closeButtonZone.isHit(xPos, yPos, _currentHoverTabRect, _isVertical);
}
return TRUE; return TRUE;
} }
_whichCloseClickDown = -1; _whichCloseClickDown = -1;