From 7e42e5b5a499d8a3a169df24c3d099481908d70d Mon Sep 17 00:00:00 2001 From: Sean Healy Date: Wed, 18 Oct 2017 23:07:47 +0200 Subject: [PATCH] Do not force the keyboard focus if there wasn't one Removing tabs tries to preserve the keyboard focus, but it should also preserve the absence of it. Signed-off-by: Adrien Destugues --- src/kits/interface/TabView.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/kits/interface/TabView.cpp b/src/kits/interface/TabView.cpp index 4b0dec72cb..d1762edd03 100644 --- a/src/kits/interface/TabView.cpp +++ b/src/kits/interface/TabView.cpp @@ -1243,10 +1243,12 @@ BTabView::RemoveTab(int32 index) else if (index <= fSelection) Select(fSelection - 1); - if (fFocus == CountTabs() - 1 || CountTabs() == 0) - SetFocusTab(fFocus, false); - else - SetFocusTab(fFocus, true); + if (fFocus >= 0) { + if (fFocus == CountTabs() - 1 || CountTabs() == 0) + SetFocusTab(fFocus, false); + else + SetFocusTab(fFocus, true); + } return tab; }