File tree Expand file tree Collapse file tree 2 files changed +29
-3
lines changed Expand file tree Collapse file tree 2 files changed +29
-3
lines changed Original file line number Diff line number Diff line change @@ -197,14 +197,18 @@ impl DrawableComponent for RevisionFilesComponent {
197
197
usize:: from ( chunks[ 0 ] . height . saturating_sub ( 2 ) ) ;
198
198
199
199
let selection = self . tree . visual_selection ( ) ;
200
- selection. map_or_else (
201
- || self . scroll_top . set ( 0 ) ,
200
+ let visual_count = selection. map_or_else (
201
+ || {
202
+ self . scroll_top . set ( 0 ) ;
203
+ 0
204
+ } ,
202
205
|selection| {
203
206
self . scroll_top . set ( ui:: calc_scroll_top (
204
207
self . scroll_top . get ( ) ,
205
208
tree_height,
206
209
selection. index ,
207
- ) )
210
+ ) ) ;
211
+ selection. count
208
212
} ,
209
213
) ;
210
214
@@ -242,6 +246,16 @@ impl DrawableComponent for RevisionFilesComponent {
242
246
items,
243
247
) ;
244
248
249
+ if is_tree_focused {
250
+ ui:: draw_scrollbar (
251
+ f,
252
+ chunks[ 0 ] ,
253
+ & self . theme ,
254
+ visual_count. saturating_sub ( tree_height) ,
255
+ self . scroll_top . get ( ) ,
256
+ ) ;
257
+ }
258
+
245
259
self . current_file . draw ( f, chunks[ 1 ] ) ?;
246
260
}
247
261
Original file line number Diff line number Diff line change @@ -187,6 +187,18 @@ impl DrawableComponent for SyntaxTextComponent {
187
187
188
188
self . scroll ( None ) ;
189
189
190
+ if self . focused ( ) {
191
+ ui:: draw_scrollbar (
192
+ f,
193
+ area,
194
+ & self . theme ,
195
+ usize:: from ( state. lines ( ) . saturating_sub (
196
+ state. height ( ) . saturating_sub ( 2 ) ,
197
+ ) ) ,
198
+ usize:: from ( state. scroll ( ) . y ) ,
199
+ ) ;
200
+ }
201
+
190
202
Ok ( ( ) )
191
203
}
192
204
}
You can’t perform that action at this time.
0 commit comments