diff options
Diffstat (limited to 'src/command.rs')
-rw-r--r-- | src/command.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/command.rs b/src/command.rs index 383389e..52ff7c8 100644 --- a/src/command.rs +++ b/src/command.rs | |||
@@ -111,7 +111,7 @@ impl CommandBox { | |||
111 | return; | 111 | return; |
112 | } | 112 | } |
113 | if let Some(idx) = self.hist_idx { | 113 | if let Some(idx) = self.hist_idx { |
114 | if !(idx + 1 >= self.history.items.len()) { | 114 | if idx + 1 < self.history.items.len() { |
115 | self.hist_idx = Some(idx + 1); | 115 | self.hist_idx = Some(idx + 1); |
116 | self.text = self.get_from_hist(); | 116 | self.text = self.get_from_hist(); |
117 | self.cursor_end(); | 117 | self.cursor_end(); |
@@ -138,6 +138,12 @@ impl CommandBox { | |||
138 | } | 138 | } |
139 | } | 139 | } |
140 | 140 | ||
141 | impl std::default::Default for CommandBox { | ||
142 | fn default() -> Self { | ||
143 | CommandBox::new() | ||
144 | } | ||
145 | } | ||
146 | |||
141 | #[derive(Debug)] | 147 | #[derive(Debug)] |
142 | pub struct History<T> { | 148 | pub struct History<T> { |
143 | pub items: Vec<T>, | 149 | pub items: Vec<T>, |