Skip to content

Commit

Permalink
refactor: clean up a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
orhun committed Dec 14, 2024
1 parent 0819daa commit b5b6946
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
7 changes: 3 additions & 4 deletions git-cliff-tui/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ impl EventHandler {
}
CrosstermEvent::FocusGained => Ok(()),
CrosstermEvent::FocusLost => Ok(()),
CrosstermEvent::Paste(_) => unimplemented!(),
CrosstermEvent::Paste(_) => Ok(()),
}
.expect("failed to send terminal event")
}
Expand Down Expand Up @@ -134,9 +134,8 @@ pub fn handle_key_events(
}
KeyCode::Char('l') | KeyCode::Char('L') | KeyCode::Right => {
state.scroll_index = state.scroll_index.saturating_add(1);

state.args.latest = !state.args.latest;
sender.send(Event::Generate(true))?;
// state.args.latest = !state.args.latest;
// sender.send(Event::Generate(true))?;
}
KeyCode::Enter => sender.send(Event::Generate(false))?,
KeyCode::Char('u') | KeyCode::Char('U') => {
Expand Down
6 changes: 4 additions & 2 deletions git-cliff-tui/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl State<'_> {
/// Constructs a new instance.
pub fn new(args: Args) -> Result<Self> {
let configs = BuiltinConfig::iter().map(|file| file.to_string()).collect();
Ok(Self {
let mut state = Self {
builtin_configs: configs,
list_state: {
let mut list_state = ListState::default();
Expand All @@ -55,7 +55,9 @@ impl State<'_> {
},
is_generating: false,
args,
})
};
state.generate_changelog(false)?;
Ok(state)
}

/// Returns the changelog contents.
Expand Down

0 comments on commit b5b6946

Please sign in to comment.