Skip to content
Snippets Groups Projects
Commit 1237c18b authored by gwenn's avatar gwenn
Browse files

Doc

parent fc0193bb
No related branches found
No related tags found
No related merge requests found
...@@ -89,6 +89,8 @@ impl History { ...@@ -89,6 +89,8 @@ impl History {
} }
/// Save the history in the specified file. /// Save the history in the specified file.
/// TODO append_history http://cnswww.cns.cwru.edu/php/chet/readline/history.html#IDX30
/// TODO history_truncate_file http://cnswww.cns.cwru.edu/php/chet/readline/history.html#IDX31
pub fn save<P: AsRef<Path> + ?Sized>(&self, path: &P) -> Result<()> { pub fn save<P: AsRef<Path> + ?Sized>(&self, path: &P) -> Result<()> {
use std::io::{BufWriter, Write}; use std::io::{BufWriter, Write};
...@@ -121,7 +123,10 @@ impl History { ...@@ -121,7 +123,10 @@ impl History {
self.entries.clear() self.entries.clear()
} }
/// Search history (start position inclusive [0, len-1]) /// Search history (start position inclusive [0, len-1]).
/// Return the absolute index of the nearest history entry that matches `term`.
/// Return None if no entry contains `term` between [start, len -1] for forward search
/// or between [0, start] for reverse search.
pub fn search(&self, term: &str, start: usize, reverse: bool) -> Option<usize> { pub fn search(&self, term: &str, start: usize, reverse: bool) -> Option<usize> {
if term.is_empty() || start >= self.len() { if term.is_empty() || start >= self.len() {
return None; return None;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment