From 7be027cdc59aa170f290ca7cfd8561f5c8c16e5b Mon Sep 17 00:00:00 2001 From: kyoto7250 <50972773+kyoto7250@users.noreply.github.com> Date: Mon, 17 Jun 2024 20:50:13 +0900 Subject: [PATCH] Prevent adding the same line and correct the starting position of offset --- src/app.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/app.rs b/src/app.rs index cf115a9..25cd003 100644 --- a/src/app.rs +++ b/src/app.rs @@ -299,7 +299,9 @@ impl App { } if let Some(index) = self.record_table.table.selected_row.selected() { - if index.saturating_add(1) % RECORDS_LIMIT_PER_PAGE as usize == 0 { + if index.saturating_add(1) % RECORDS_LIMIT_PER_PAGE as usize == 0 + && index >= self.record_table.table.rows.len() - 1 + { if let Some((database, table)) = self.databases.tree().selected_table() { @@ -310,7 +312,7 @@ impl App { .get_records( &database, &table, - index as u16, + index.saturating_add(1) as u16, if self.record_table.filter.input_str().is_empty() { None } else {