Skip to content

Commit

Permalink
refactor(minibuffer): rename command_history -> git_command_history
Browse files Browse the repository at this point in the history
  • Loading branch information
Piturnah committed Jul 17, 2023
1 parent a2dc913 commit a2a828a
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/minibuffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>,
git_command_history: Vec<String>,
}

pub enum MessageType {
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
Expand Down Expand Up @@ -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(())
Expand Down

0 comments on commit a2a828a

Please sign in to comment.