Skip to content

Commit

Permalink
Merge pull request #821 from gwenn/boxed_comp
Browse files Browse the repository at this point in the history
Test completer impls
  • Loading branch information
gwenn authored Oct 27, 2024
2 parents bc1667e + e97e64f commit bdc2f60
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
15 changes: 12 additions & 3 deletions src/completion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,8 @@ fn find_unclosed_quote(s: &str) -> Option<(usize, Quote)> {

#[cfg(test)]
mod tests {
use super::{Completer, FilenameCompleter};

#[test]
pub fn extract_word() {
let break_chars = super::default_break_chars;
Expand Down Expand Up @@ -604,16 +606,23 @@ mod tests {
#[test]
pub fn candidate_impls() {
struct StrCmp;
impl super::Completer for StrCmp {
impl Completer for StrCmp {
type Candidate = &'static str;
}
struct RcCmp;
impl super::Completer for RcCmp {
impl Completer for RcCmp {
type Candidate = std::rc::Rc<str>;
}
struct ArcCmp;
impl super::Completer for ArcCmp {
impl Completer for ArcCmp {
type Candidate = std::sync::Arc<str>;
}
}

#[test]
pub fn completer_impls() {
struct Wrapper<T: Completer>(T);
let boxed = Box::new(FilenameCompleter::new());
let _ = Wrapper(boxed);
}
}
2 changes: 1 addition & 1 deletion src/tty/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1032,7 +1032,7 @@ impl Renderer for PosixRenderer {
}
// position the cursor within the line
if cursor.col > 0 {
write!(self.buffer, "\r\x1b[{}C", cursor.col).unwrap();
write!(self.buffer, "\r\x1b[{}C", cursor.col)?;
} else {
self.buffer.push('\r');
}
Expand Down

0 comments on commit bdc2f60

Please sign in to comment.