Skip to content

Commit 4ac13ef

Browse files
committed
Using SubViews and letting the top-level handle the key if the TabView doesn't handle it
1 parent b5399a5 commit 4ac13ef

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

Terminal.Gui/Views/TabView/TabView.cs

+8-10
Original file line numberDiff line numberDiff line change
@@ -105,15 +105,14 @@ public TabView ()
105105

106106
if (mostFocused is { })
107107
{
108-
for (int? i = mostFocused.SuperView?.InternalSubViews.IndexOf (mostFocused) - 1; i > -1; i--)
108+
for (int? i = mostFocused.SuperView?.SubViews.IndexOf (mostFocused) - 1; i > -1; i--)
109109
{
110-
var view = mostFocused.SuperView?.InternalSubViews [(int)i];
110+
var view = mostFocused.SuperView?.SubViews.ElementAt ((int)i);
111111

112112
if (view is { CanFocus: true, Enabled: true, Visible: true })
113113
{
114-
view.SetFocus ();
115-
116-
return true;
114+
// Let toplevel handle it
115+
return false;
117116
}
118117
}
119118
}
@@ -140,15 +139,14 @@ public TabView ()
140139

141140
if (mostFocused is { })
142141
{
143-
for (int? i = mostFocused.SuperView?.InternalSubViews.IndexOf (mostFocused) + 1; i < mostFocused.SuperView?.InternalSubViews.Count; i++)
142+
for (int? i = mostFocused.SuperView?.SubViews.IndexOf (mostFocused) + 1; i < mostFocused.SuperView?.SubViews.Count; i++)
144143
{
145-
var view = mostFocused.SuperView?.InternalSubViews [(int)i];
144+
var view = mostFocused.SuperView?.SubViews.ElementAt ((int)i);
146145

147146
if (view is { CanFocus: true, Enabled: true, Visible: true })
148147
{
149-
view.SetFocus ();
150-
151-
return true;
148+
// Let toplevel handle it
149+
return false;
152150
}
153151
}
154152
}

0 commit comments

Comments
 (0)