Skip to content

Commit e5d902b

Browse files
committed
fix(tabbookmark): avoid unexpected behavior when keep_last_tab is unset
For `HandleMiddleClick`, expensive UI operations (like `GetTopContainerView` and `IsOnOneTab`) are now bypassed before checking if the feature was disabled. For `HandleKeepTab`, the function will not force exit full-screen mode and close the find bar before verifying if the feature was disabled.
1 parent f2f8d43 commit e5d902b

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/tabbookmark.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,10 @@ bool HandleRightClick(const MOUSEHOOKSTRUCT* pmouse) {
150150

151151
// Preserve the last tab when the middle button is clicked on the tab.
152152
bool HandleMiddleClick(const MOUSEHOOKSTRUCT* pmouse) {
153+
if (!config.IsKeepLastTab()) {
154+
return false;
155+
}
156+
153157
const POINT pt = pmouse->pt;
154158
HWND hwnd = WindowFromPoint(pt);
155159
const NodePtr top_container_view = HandleFindBar(hwnd, pt);
@@ -304,6 +308,10 @@ bool TabBookmarkMouseHandler(WPARAM wParam, LPARAM lParam) {
304308
}
305309

306310
int HandleKeepTab(WPARAM wParam) {
311+
if (!config.IsKeepLastTab()) {
312+
return 0;
313+
}
314+
307315
if (!(wParam == 'W' && IsKeyPressed(VK_CONTROL) && !IsKeyPressed(VK_SHIFT)) &&
308316
!(wParam == VK_F4 && IsKeyPressed(VK_CONTROL))) {
309317
return 0;

0 commit comments

Comments
 (0)