Skip to content

Commit 18f59a3

Browse files
committed
fix: prevent focus shift when selecting auto-created tabs
1 parent 62d82c4 commit 18f59a3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

MainWindow.xaml.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,12 @@ private void AddNewTab(string tabName, string regexPattern, int afterLines, bool
643643
// Add the tab to the tab control BEFORE the "+" tab
644644
int addButtonIndex = tabControl.Items.IndexOf(addTabButton);
645645
tabControl.Items.Insert(addButtonIndex, tabItem);
646-
tabControl.SelectedItem = tabItem;
646+
647+
// Only select the new tab if it's not auto-created to avoid shifting focus
648+
if (!isAutoCreated)
649+
{
650+
tabControl.SelectedItem = tabItem;
651+
}
647652
}
648653

649654
private void ContentBox_KeyDown(object sender, KeyEventArgs e)

0 commit comments

Comments
 (0)