Skip to content

Commit

Permalink
Merge pull request #30 from ynqa/crossterm
Browse files Browse the repository at this point in the history
Bump up the version of crossterm to v0.28.1
  • Loading branch information
ynqa authored Sep 7, 2024
2 parents 3e04e60 150263c commit 97c1dc6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 16 deletions.
2 changes: 1 addition & 1 deletion promkit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 14,7 @@ path = "src/lib.rs"

[dependencies]
anyhow = "1.0.81"
crossterm = { version = "0.27.0", features = ["use-dev-tty"] }
crossterm = { version = "0.28.1", features = ["use-dev-tty"] }
indexmap = "2.2.3"
radix_trie = "0.2.1"
serde = { version = "1.0.197" }
Expand Down
6 changes: 0 additions & 6 deletions promkit/src/core/listbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 36,6 @@ impl<T: fmt::Display> FromIterator<T> for Listbox {
}
}

impl FromIterator<StyledGraphemes> for Listbox {
fn from_iter<T: IntoIterator<Item = StyledGraphemes>>(iter: T) -> Self {
Self(Cursor::new(iter.into_iter().collect(), 0, false))
}
}

impl Listbox {
/// Returns a reference to the vector of items in the listbox.
pub fn items(&self) -> &Vec<StyledGraphemes> {
Expand Down
15 changes: 6 additions & 9 deletions promkit/src/grapheme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 28,12 @@ impl From<char> for StyledGrapheme {
}
}

impl ToString for StyledGrapheme {
fn to_string(&self) -> String {
self.ch.to_string()
impl fmt::Display for StyledGraphemes {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
for styled_grapheme in self.iter() {
write!(f, "{}", styled_grapheme.ch)?;
}
Ok(())
}
}

Expand Down Expand Up @@ -117,12 120,6 @@ impl fmt::Debug for StyledGraphemes {
}
}

impl ToString for StyledGraphemes {
fn to_string(&self) -> String {
self.iter().map(|g| g.ch).collect()
}
}

impl StyledGraphemes {
pub fn from_str<S: AsRef<str>>(string: S, style: ContentStyle) -> Self {
string
Expand Down

0 comments on commit 97c1dc6

Please sign in to comment.