mirror of
https://github.com/notohh/rustlings.git
synced 2024-10-30 16:59:12 -04:00
Set a list offset
This commit is contained in:
parent
0bf3f7e01f
commit
05729b27a0
1 changed files with 5 additions and 2 deletions
|
@ -77,12 +77,15 @@ impl<'a> UiState<'a> {
|
||||||
.highlight_symbol("🦀")
|
.highlight_symbol("🦀")
|
||||||
.block(Block::default().borders(Borders::BOTTOM));
|
.block(Block::default().borders(Borders::BOTTOM));
|
||||||
|
|
||||||
let selected = 0;
|
let selected = state_file.next_exercise_ind();
|
||||||
|
let table_state = TableState::default()
|
||||||
|
.with_offset(selected.saturating_sub(3))
|
||||||
|
.with_selected(Some(selected));
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
table,
|
table,
|
||||||
selected,
|
selected,
|
||||||
table_state: TableState::default().with_selected(Some(selected)),
|
table_state,
|
||||||
last_ind: exercises.len() - 1,
|
last_ind: exercises.len() - 1,
|
||||||
message: String::with_capacity(128),
|
message: String::with_capacity(128),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue