From a2a828a80b5a5149c54f3942356c568026f98515 Mon Sep 17 00:00:00 2001 From: Peter Hebden Date: Mon, 17 Jul 2023 15:21:11 +0100 Subject: [PATCH] refactor(minibuffer): rename `command_history` -> `git_command_history` --- src/minibuffer.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/minibuffer.rs b/src/minibuffer.rs index f44005f..74703bf 100644 --- a/src/minibuffer.rs +++ b/src/minibuffer.rs @@ -25,7 +25,7 @@ pub struct MiniBuffer { /// The current height of the buffer, including the border. current_height: usize, /// History of commands sent via `:`. - command_history: Vec, + git_command_history: Vec, } pub enum MessageType { @@ -116,9 +116,10 @@ impl MiniBuffer { } } (KeyCode::Up, _) | (KeyCode::Char('p'), KeyModifiers::CONTROL) => { - if history_cursor < self.command_history.len() { + if history_cursor < self.git_command_history.len() { history_cursor += 1; - self.command_history[self.command_history.len() - history_cursor] + self.git_command_history + [self.git_command_history.len() - history_cursor] .clone_into(&mut command); cursor = command.len() as u16; } @@ -128,7 +129,8 @@ impl MiniBuffer { if history_cursor == 0 { command.clear(); } else { - self.command_history[self.command_history.len() - history_cursor] + self.git_command_history + [self.git_command_history.len() - history_cursor] .clone_into(&mut command); } cursor = command.len() as u16; @@ -185,7 +187,7 @@ impl MiniBuffer { )?); terminal::enable_raw_mode().context("failed to enable raw mode")?; - self.command_history.push(command); + self.git_command_history.push(command); print!("{}", cursor::Hide); Ok(())