File tree Expand file tree Collapse file tree 3 files changed +124
-105
lines changed
Terminal.Gui/Views/TabView Expand file tree Collapse file tree 3 files changed +124
-105
lines changed Original file line number Diff line number Diff line change 1
1
#nullable enable
2
2
namespace Terminal . Gui ;
3
3
4
- internal class TabRowView : View
4
+ internal class TabRow : View
5
5
{
6
6
private readonly TabView _host ;
7
7
private readonly View _leftScrollIndicator ;
8
8
private readonly View _rightScrollIndicator ;
9
9
10
- public TabRowView ( TabView host )
10
+ public TabRow ( TabView host )
11
11
{
12
12
_host = host ;
13
- Id = "tabRowView " ;
13
+ Id = "tabRow " ;
14
14
15
15
CanFocus = true ;
16
+ TabStop = TabBehavior . TabGroup ;
16
17
Width = Dim . Fill ( ) ;
17
18
18
19
_rightScrollIndicator = new View
@@ -59,25 +60,25 @@ protected override bool OnMouseEvent (MouseEventArgs me)
59
60
}
60
61
}
61
62
62
- if ( ! me . IsSingleDoubleOrTripleClicked )
63
+ if ( me . IsWheel && ! HasFocus && CanFocus )
63
64
{
64
- return false ;
65
+ SetFocus ( ) ;
65
66
}
66
67
67
- if ( ! HasFocus && CanFocus )
68
+ if ( me is { IsSingleDoubleOrTripleClicked : false , IsWheel : false } )
68
69
{
69
- SetFocus ( ) ;
70
+ return false ;
70
71
}
71
72
72
- if ( me . IsSingleDoubleOrTripleClicked )
73
+ if ( me . IsSingleDoubleOrTripleClicked || me . IsWheel )
73
74
{
74
75
var scrollIndicatorHit = 0 ;
75
76
76
- if ( me . View is { Id : "rightScrollIndicator" } )
77
+ if ( me . View is { Id : "rightScrollIndicator" } || me . Flags . HasFlag ( MouseFlags . WheeledDown ) || me . Flags . HasFlag ( MouseFlags . WheeledRight ) )
77
78
{
78
79
scrollIndicatorHit = 1 ;
79
80
}
80
- else if ( me . View is { Id : "leftScrollIndicator" } )
81
+ else if ( me . View is { Id : "leftScrollIndicator" } || me . Flags . HasFlag ( MouseFlags . WheeledUp ) || me . Flags . HasFlag ( MouseFlags . WheeledLeft ) )
81
82
{
82
83
scrollIndicatorHit = - 1 ;
83
84
}
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ public class TabView : View
16
16
private readonly List < Tab > _tabs = new ( ) ;
17
17
18
18
/// <summary>This sub view is the 2 or 3 line control that represents the actual tabs themselves.</summary>
19
- private readonly TabRowView _tabsBar ;
19
+ private readonly TabRow _tabsBar ;
20
20
21
21
private Tab ? _selectedTab ;
22
22
@@ -28,7 +28,7 @@ public TabView ()
28
28
{
29
29
CanFocus = true ;
30
30
TabStop = TabBehavior . TabStop ; // Because TabView has focusable subviews, it must be a TabGroup
31
- _tabsBar = new TabRowView ( this ) ;
31
+ _tabsBar = new TabRow ( this ) ;
32
32
_containerView = new ( ) ;
33
33
ApplyStyleChanges ( ) ;
34
34
@@ -518,6 +518,10 @@ internal IEnumerable<Tab> CalculateViewport (Rectangle bounds)
518
518
{
519
519
SelectedTab ? . SetFocus ( ) ;
520
520
}
521
+ else
522
+ {
523
+ SelectedTab ? . View ? . SetFocus ( ) ;
524
+ }
521
525
}
522
526
523
527
/// <summary>
You can’t perform that action at this time.
0 commit comments