Merge pull request #135 from kkawakam/broken-links
Fix broken links
diff --git a/Cargo.toml b/Cargo.toml
index 9b940d8..9346f56 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,6 +13,7 @@
[badges]
travis-ci = { repository = "kkawakam/rustyline" }
appveyor = { repository = "kkawakam/rustyline" }
+maintenance = { status = "actively-developed" }
[dependencies]
libc = "0.2"
diff --git a/README.md b/README.md
index 99f345b..2f39036 100644
--- a/README.md
+++ b/README.md
@@ -69,8 +69,8 @@
- Unicode (UTF-8) (linenoise supports only ASCII)
- Word completion (linenoise supports only line completion)
- Filename completion
- - History search ([Searching for Commands in the History](http://cnswww.cns.cwru.edu/php/chet/readline/readline.html#SEC8))
- - Kill ring ([Killing Commands](http://cnswww.cns.cwru.edu/php/chet/readline/readline.html#IDX3))
+ - History search ([Searching for Commands in the History](http://tiswww.case.edu/php/chet/readline/readline.html#SEC8))
+ - Kill ring ([Killing Commands](http://tiswww.case.edu/php/chet/readline/readline.html#IDX3))
- Multi line mode (line wrapping)
- Word commands
- Hints
diff --git a/src/keymap.rs b/src/keymap.rs
index 3652493..eb3d560 100644
--- a/src/keymap.rs
+++ b/src/keymap.rs
@@ -205,8 +205,8 @@
}
impl CharSearch {
- fn opposite(&self) -> CharSearch {
- match *self {
+ fn opposite(self) -> CharSearch {
+ match self {
CharSearch::Forward(c) => CharSearch::Backward(c),
CharSearch::ForwardBefore(c) => CharSearch::BackwardAfter(c),
CharSearch::Backward(c) => CharSearch::Forward(c),
diff --git a/src/line_buffer.rs b/src/line_buffer.rs
index 7c16bb1..fbe7239 100644
--- a/src/line_buffer.rs
+++ b/src/line_buffer.rs
@@ -10,7 +10,7 @@
use unicode_segmentation::UnicodeSegmentation;
/// Maximum buffer size for the line read
-pub static MAX_LINE: usize = 4096;
+pub(crate) static MAX_LINE: usize = 4096;
/// Word's case change
#[derive(Clone, Copy)]
@@ -22,7 +22,7 @@
/// Delete (kill) direction
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
-pub enum Direction {
+pub(crate) enum Direction {
Forward,
Backward,
}
@@ -34,14 +34,14 @@
}
/// Listener to be notified when some text is deleted.
-pub trait DeleteListener {
+pub(crate) trait DeleteListener {
fn start_killing(&mut self);
fn delete(&mut self, idx: usize, string: &str, dir: Direction);
fn stop_killing(&mut self);
}
/// Listener to be notified when the line is modified.
-pub trait ChangeListener: DeleteListener {
+pub(crate) trait ChangeListener: DeleteListener {
fn insert_char(&mut self, idx: usize, c: char);
fn insert_str(&mut self, idx: usize, string: &str);
fn replace(&mut self, idx: usize, old: &str, new: &str);
@@ -78,7 +78,11 @@
}
#[cfg(test)]
- pub fn init(line: &str, pos: usize, cl: Option<Rc<RefCell<ChangeListener>>>) -> LineBuffer {
+ pub(crate) fn init(
+ line: &str,
+ pos: usize,
+ cl: Option<Rc<RefCell<ChangeListener>>>,
+ ) -> LineBuffer {
let mut lb = Self::with_capacity(MAX_LINE);
assert!(lb.insert_str(0, line));
lb.set_pos(pos);
@@ -86,16 +90,13 @@
lb
}
- pub fn set_delete_listener(&mut self, dl: Arc<Mutex<DeleteListener>>) {
+ pub(crate) fn set_delete_listener(&mut self, dl: Arc<Mutex<DeleteListener>>) {
self.dl = Some(dl);
}
- pub fn remove_delete_listener(&mut self) {
- self.dl = None;
- }
- pub fn set_change_listener(&mut self, dl: Rc<RefCell<ChangeListener>>) {
+ pub(crate) fn set_change_listener(&mut self, dl: Rc<RefCell<ChangeListener>>) {
self.cl = Some(dl);
}
- pub fn remove_change_listener(&mut self) {
+ pub(crate) fn remove_change_listener(&mut self) {
self.cl = None;
}
@@ -475,9 +476,9 @@
}
}
- fn search_char_pos(&self, cs: &CharSearch, n: RepeatCount) -> Option<usize> {
+ fn search_char_pos(&self, cs: CharSearch, n: RepeatCount) -> Option<usize> {
let mut shift = 0;
- let search_result = match *cs {
+ let search_result = match cs {
CharSearch::Backward(c) | CharSearch::BackwardAfter(c) => self.buf[..self.pos]
.char_indices()
.rev()
@@ -504,7 +505,7 @@
}
};
if let Some(pos) = search_result {
- Some(match *cs {
+ Some(match cs {
CharSearch::Backward(_) => pos,
CharSearch::BackwardAfter(c) => pos + c.len_utf8(),
CharSearch::Forward(_) => shift + pos,
@@ -525,7 +526,7 @@
/// Move cursor to the matching character position.
/// Return `true` when the search succeeds.
pub fn move_to(&mut self, cs: CharSearch, n: RepeatCount) -> bool {
- if let Some(pos) = self.search_char_pos(&cs, n) {
+ if let Some(pos) = self.search_char_pos(cs, n) {
self.pos = pos;
true
} else {
@@ -547,8 +548,8 @@
pub fn delete_to(&mut self, cs: CharSearch, n: RepeatCount) -> bool {
let search_result = match cs {
- CharSearch::ForwardBefore(c) => self.search_char_pos(&CharSearch::Forward(c), n),
- _ => self.search_char_pos(&cs, n),
+ CharSearch::ForwardBefore(c) => self.search_char_pos(CharSearch::Forward(c), n),
+ _ => self.search_char_pos(cs, n),
};
if let Some(pos) = search_result {
match cs {
@@ -732,10 +733,8 @@
}
Movement::ViCharSearch(n, cs) => {
let search_result = match cs {
- CharSearch::ForwardBefore(c) => {
- self.search_char_pos(&CharSearch::Forward(c), n)
- }
- _ => self.search_char_pos(&cs, n),
+ CharSearch::ForwardBefore(c) => self.search_char_pos(CharSearch::Forward(c), n),
+ _ => self.search_char_pos(cs, n),
};
if let Some(pos) = search_result {
Some(match cs {