mirror of
https://github.com/TaKO8Ki/gobang
synced 2024-11-11 07:10:31 +00:00
always reset offset
This commit is contained in:
parent
0b0f56ed43
commit
4b27857bc5
@ -59,8 +59,8 @@ impl TableComponent {
|
|||||||
database: Database,
|
database: Database,
|
||||||
table: DTable,
|
table: DTable,
|
||||||
) {
|
) {
|
||||||
if !rows.is_empty() {
|
|
||||||
self.selected_row.select(None);
|
self.selected_row.select(None);
|
||||||
|
if !rows.is_empty() {
|
||||||
self.selected_row.select(Some(0))
|
self.selected_row.select(Some(0))
|
||||||
}
|
}
|
||||||
self.headers = headers;
|
self.headers = headers;
|
||||||
@ -97,7 +97,7 @@ impl TableComponent {
|
|||||||
let i = match self.selected_row.selected() {
|
let i = match self.selected_row.selected() {
|
||||||
Some(i) => {
|
Some(i) => {
|
||||||
if i + lines >= self.rows.len() {
|
if i + lines >= self.rows.len() {
|
||||||
Some(self.rows.len() - 1)
|
Some(self.rows.len().saturating_sub(1))
|
||||||
} else {
|
} else {
|
||||||
Some(i + lines)
|
Some(i + lines)
|
||||||
}
|
}
|
||||||
@ -114,7 +114,7 @@ impl TableComponent {
|
|||||||
if i <= lines {
|
if i <= lines {
|
||||||
Some(0)
|
Some(0)
|
||||||
} else {
|
} else {
|
||||||
Some(i - lines)
|
Some(i.saturating_sub(lines))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
None => None,
|
None => None,
|
||||||
@ -136,7 +136,8 @@ impl TableComponent {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
self.reset_selection();
|
self.reset_selection();
|
||||||
self.selected_row.select(Some(self.rows.len() - 1));
|
self.selected_row
|
||||||
|
.select(Some(self.rows.len().saturating_sub(1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn next_column(&mut self) {
|
fn next_column(&mut self) {
|
||||||
|
Loading…
Reference in New Issue
Block a user