From b5b6946a6f475f20ea7440f5363d1ac438a7bc3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Orhun=20Parmaks=C4=B1z?= Date: Sat, 14 Dec 2024 18:52:10 +0300 Subject: [PATCH] refactor: clean up a bit --- git-cliff-tui/src/event.rs | 7 +++---- git-cliff-tui/src/state.rs | 6 ++++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/git-cliff-tui/src/event.rs b/git-cliff-tui/src/event.rs index a42625fb8b..6ff9990cfb 100644 --- a/git-cliff-tui/src/event.rs +++ b/git-cliff-tui/src/event.rs @@ -77,7 +77,7 @@ impl EventHandler { } CrosstermEvent::FocusGained => Ok(()), CrosstermEvent::FocusLost => Ok(()), - CrosstermEvent::Paste(_) => unimplemented!(), + CrosstermEvent::Paste(_) => Ok(()), } .expect("failed to send terminal event") } @@ -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') => { diff --git a/git-cliff-tui/src/state.rs b/git-cliff-tui/src/state.rs index 305faa409b..8638ccb7c9 100644 --- a/git-cliff-tui/src/state.rs +++ b/git-cliff-tui/src/state.rs @@ -35,7 +35,7 @@ impl State<'_> { /// Constructs a new instance. pub fn new(args: Args) -> Result { 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(); @@ -55,7 +55,9 @@ impl State<'_> { }, is_generating: false, args, - }) + }; + state.generate_changelog(false)?; + Ok(state) } /// Returns the changelog contents.