File tree Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,15 @@ impl<'a> Paging<'a> {
42
42
}
43
43
}
44
44
45
+ pub fn update_page ( & mut self , cursor_pos : usize ) {
46
+ if cursor_pos != !0
47
+ && ( cursor_pos < self . current_page * self . capacity
48
+ || cursor_pos >= ( self . current_page + 1 ) * self . capacity )
49
+ {
50
+ self . current_page = cursor_pos / self . capacity ;
51
+ }
52
+ }
53
+
45
54
/// Updates all internal based on the current terminal size and cursor position
46
55
pub fn update ( & mut self , cursor_pos : usize ) -> Result {
47
56
let new_term_size = self . term . size ( ) ;
@@ -65,12 +74,7 @@ impl<'a> Paging<'a> {
65
74
self . term . clear_last_lines ( self . capacity ) ?;
66
75
}
67
76
68
- if cursor_pos != !0
69
- && ( cursor_pos < self . current_page * self . capacity
70
- || cursor_pos >= ( self . current_page + 1 ) * self . capacity )
71
- {
72
- self . current_page = cursor_pos / self . capacity ;
73
- }
77
+ self . update_page ( cursor_pos) ;
74
78
75
79
Ok ( ( ) )
76
80
}
Original file line number Diff line number Diff line change @@ -214,7 +214,7 @@ impl Select<'_> {
214
214
}
215
215
216
216
term. hide_cursor ( ) ?;
217
- paging. update ( sel) ? ;
217
+ paging. update_page ( sel) ;
218
218
219
219
loop {
220
220
if let Some ( ref prompt) = self . prompt {
You can’t perform that action at this time.
0 commit comments