Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
final touches for MVP
  • Loading branch information
phiresky committed Apr 1, 2022
commit b57135d2a9ddaaf25c29d5c4f39806d450ba36df
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ strip-ansi-escapes = "0.1.1"
strum = "0.24"
strum_macros = "0.24"
fd-lock = "3.0.3"
rusqlite = { version = "0.27.0", optional = true }
rusqlite = { version = "0.27.0", optional = true, features = ["bundled"] }
serde_json = { version = "1.0.79", optional = true }

[dev-dependencies]
Expand Down
1 change: 0 additions & 1 deletion src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,6 @@ impl Reedline {
let history: Vec<_> = self
.history
.iter_chronologic()
.cloned()
.enumerate()
.collect();

Expand Down
3 changes: 1 addition & 2 deletions src/history/base.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use crate::core_editor::LineBuffer;
use std::collections::vec_deque::Iter;

/// Browsing modes for a [`History`]
#[derive(Debug, Clone, PartialEq, Eq)]
Expand All @@ -20,7 +19,7 @@ pub trait History: Send {
fn append(&mut self, entry: &str);

/// Chronologic interaction over all entries present in the history
fn iter_chronologic(&self) -> Iter<'_, String>;
fn iter_chronologic(&self) -> Box<dyn DoubleEndedIterator<Item=String> + '_>;

/// This moves the cursor backwards respecting the navigation query that is set
/// - Results in a no-op if the cursor is at the initial point
Expand Down
5 changes: 2 additions & 3 deletions src/history/file_backed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ impl History for FileBackedHistory {
self.reset_cursor();
}

fn iter_chronologic(&self) -> Iter<'_, String> {
self.entries.iter()
fn iter_chronologic(&self) -> Box<(dyn DoubleEndedIterator<Item = String> + '_)> {
Box::new(self.entries.iter().map(|e| e.to_string()))
}

fn back(&mut self) {
Expand Down Expand Up @@ -121,7 +121,6 @@ impl History for FileBackedHistory {
self.iter_chronologic()
.rev()
.filter(|entry| entry.contains(search))
.cloned()
.collect::<Vec<String>>()
}

Expand Down
Loading