Terminals
Terminals copied to clipboard
new SSH sessions do not get focus automatically
When I open a new SSH session from one of my favorites via the folders/slideout on the left window side, the SSH session does not automatically get the focus. I cannot enter any characters and I first need to click into the session with the mouse. This does not happen (e.g. the SSH session immediately accepts my input) when I open it from the favorites menu instead. The problem also does not happen to RDP sessions in either case.
It`s because not a child window. then it active main terminal window lost focus. add WS_CHILD style to window can not be applied :( TabControl.TabControl.cs
public TabControlItem SelectedItem
{
get => this.selectedItem;
set
{
if (this.selectedItem == value)
return;
if (value == null && this.Items.Count > 0)
{
var itm = this.Items[0];
if (itm.Visible)
{
this.selectedItem = itm;
this.selectedItem.Selected = true;
this.selectedItem.Dock = DockStyle.Fill;
}
}
else
{
this.selectedItem = value;
}
foreach (TabControlItem itm in this.Items)
{
if (itm != this.selectedItem)
{
this.UnSelectItem(itm);
itm.Hide();
}
}
this.Invalidate();
if (this.selectedItem != null)
{
this.SelectItem(this.selectedItem);
this.selectedItem.Show();
if (this.selectedItem.Controls.Count == 1)
{
if (this.selectedItem.Controls[0] is IFocusable fc && !fc.ContainsFocus)
{
((IFocusable)this.selectedItem.Controls[0]).Focus();
}
}
}
this.OnTabControlItemChanged(new TabControlItemChangedEventArgs(this.selectedItem, TabControlItemChangeTypes.SelectionChanged));
}
}