Skip to content

Commit

Permalink
Fix: Scroll offset in Title Select Popup was off (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
jooaf authored Jan 24, 2025
1 parent c02f981 commit 1ebec63
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/title_select_popup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ impl TitleSelectPopup {
self.selected_index = self.filtered_titles.len() - 1;
}

if self.selected_index < self.scroll_offset {
if self.selected_index <= self.scroll_offset {
self.scroll_offset = self.selected_index;
}
if self.selected_index == self.filtered_titles.len() - 1 {
Expand Down
6 changes: 3 additions & 3 deletions src/ui_handler.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::{get_save_backup_file_path, EditorClipboard, BORDER_PADDING_SIZE};
use crate::{get_save_backup_file_path, EditorClipboard};
use anyhow::{bail, Result};
use crossterm::{
event::{self, DisableMouseCapture, EnableMouseCapture, KeyCode, KeyModifiers},
Expand Down Expand Up @@ -243,8 +243,8 @@ fn handle_title_select_popup_input(state: &mut UIState, key: event::KeyEvent) ->
// The borders are rendered using unicode box-drawing characters:
// top border : ┌───┐
// bottom border : └───┘
let visible_items = (state.scrollable_textarea.viewport_height as f32 * 0.8).floor() as usize
- BORDER_PADDING_SIZE;
let visible_items =
(state.scrollable_textarea.viewport_height as f32 * 0.8).floor() as usize - 10;

match key.code {
KeyCode::Enter => {
Expand Down

0 comments on commit 1ebec63

Please sign in to comment.