@@ -81,6 +81,9 @@ pub struct Status {
81
81
git_action_executed : bool ,
82
82
options : SharedOptions ,
83
83
key_config : SharedKeyConfig ,
84
+ horizontal_split : ( u16 , u16 ) , // Left vs Right
85
+ vertical_split_wd : ( u16 , u16 ) , // Top vs Bottom when WorkingDir
86
+ vertical_split_index : ( u16 , u16 ) ,
84
87
}
85
88
86
89
impl DrawableComponent for Status {
@@ -112,8 +115,12 @@ impl DrawableComponent for Status {
112
115
]
113
116
} else {
114
117
[
115
- Constraint :: Percentage ( 50 ) ,
116
- Constraint :: Percentage ( 50 ) ,
118
+ Constraint :: Percentage (
119
+ self . horizontal_split . 0 ,
120
+ ) ,
121
+ Constraint :: Percentage (
122
+ self . horizontal_split . 1 ,
123
+ ) ,
117
124
]
118
125
}
119
126
. as_ref ( ) ,
@@ -125,13 +132,21 @@ impl DrawableComponent for Status {
125
132
. constraints (
126
133
if self . diff_target == DiffTarget :: WorkingDir {
127
134
[
128
- Constraint :: Percentage ( 60 ) ,
129
- Constraint :: Percentage ( 40 ) ,
135
+ Constraint :: Percentage (
136
+ self . vertical_split_wd . 0 ,
137
+ ) ,
138
+ Constraint :: Percentage (
139
+ self . vertical_split_wd . 1 ,
140
+ ) ,
130
141
]
131
142
} else {
132
143
[
133
- Constraint :: Percentage ( 40 ) ,
134
- Constraint :: Percentage ( 60 ) ,
144
+ Constraint :: Percentage (
145
+ self . vertical_split_index . 0 ,
146
+ ) ,
147
+ Constraint :: Percentage (
148
+ self . vertical_split_index . 1 ,
149
+ ) ,
135
150
]
136
151
}
137
152
. as_ref ( ) ,
@@ -200,6 +215,9 @@ impl Status {
200
215
key_config : env. key_config . clone ( ) ,
201
216
options : env. options . clone ( ) ,
202
217
repo : env. repo . clone ( ) ,
218
+ horizontal_split : ( 50 , 50 ) ,
219
+ vertical_split_wd : ( 60 , 40 ) ,
220
+ vertical_split_index : ( 40 , 60 ) ,
203
221
}
204
222
}
205
223
@@ -947,6 +965,49 @@ impl Component for Status {
947
965
) {
948
966
self . queue . push ( InternalEvent :: ViewSubmodules ) ;
949
967
Ok ( EventState :: Consumed )
968
+ } else if key_match ( k, self . key_config . keys . alt_left )
969
+ {
970
+ if self . horizontal_split . 0 > 10 {
971
+ self . horizontal_split . 0 -= 5 ;
972
+ self . horizontal_split . 1 += 5 ;
973
+ }
974
+ Ok ( EventState :: Consumed )
975
+ } else if key_match ( k, self . key_config . keys . alt_right )
976
+ {
977
+ if self . horizontal_split . 1 > 10 {
978
+ self . horizontal_split . 0 += 5 ;
979
+ self . horizontal_split . 1 -= 5 ;
980
+ }
981
+ Ok ( EventState :: Consumed )
982
+ } else if key_match ( k, self . key_config . keys . alt_up ) {
983
+ let ( top, bottom) = match self . diff_target {
984
+ DiffTarget :: WorkingDir => {
985
+ & mut self . vertical_split_wd
986
+ }
987
+ DiffTarget :: Stage => {
988
+ & mut self . vertical_split_index
989
+ }
990
+ } ;
991
+ if * bottom > 10 {
992
+ * top += 5 ;
993
+ * bottom -= 5 ;
994
+ }
995
+ Ok ( EventState :: Consumed )
996
+ } else if key_match ( k, self . key_config . keys . alt_down )
997
+ {
998
+ let ( top, bottom) = match self . diff_target {
999
+ DiffTarget :: WorkingDir => {
1000
+ & mut self . vertical_split_wd
1001
+ }
1002
+ DiffTarget :: Stage => {
1003
+ & mut self . vertical_split_index
1004
+ }
1005
+ } ;
1006
+ if * top > 10 {
1007
+ * top -= 5 ;
1008
+ * bottom += 5 ;
1009
+ }
1010
+ Ok ( EventState :: Consumed )
950
1011
} else {
951
1012
Ok ( EventState :: NotConsumed )
952
1013
} ;
0 commit comments