Skip to content

Commit

Permalink
Update crossterm dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
jeff-hughes committed Feb 26, 2022
1 parent be2c7f6 commit ee0235e
Show file tree
Hide file tree
Showing 7 changed files with 106 additions and 58 deletions.
106 changes: 74 additions & 32 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 @@ -16,7 +16,7 @@ readme = "README.md"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
crossterm = "0.19.0"
crossterm = "0.23.0"
rss = "1.10.0"
rusqlite = "0.21.0"
ureq = "2.4.0"
Expand Down
10 changes: 5 additions & 5 deletions src/ui/details_panel.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::rc::Rc;

use chrono::{DateTime, Utc};
use crossterm::style;
use crossterm::style::{self, Stylize};

use super::panel::Panel;
use super::AppColors;
Expand Down Expand Up @@ -131,12 +131,12 @@ impl DetailsPanel {
if let Some(details) = &self.details {
let num_cols = self.panel.get_cols() as usize;
let bold = style::ContentStyle::new()
.foreground(self.panel.colors.bold.0)
.background(self.panel.colors.bold.1)
.with(self.panel.colors.bold.0)
.on(self.panel.colors.bold.1)
.attribute(style::Attribute::Bold);
let underlined = style::ContentStyle::new()
.foreground(self.panel.colors.normal.0)
.background(self.panel.colors.normal.1)
.with(self.panel.colors.normal.0)
.on(self.panel.colors.normal.1)
.attribute(style::Attribute::Underlined);

self.content.clear();
Expand Down
33 changes: 18 additions & 15 deletions src/ui/menu.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::cmp::min;
use std::collections::hash_map::Entry;

use crossterm::style;
use crossterm::style::{self, Stylize};

use super::{Panel, Scroll};
use crate::types::*;
Expand Down Expand Up @@ -85,13 +85,13 @@ impl<T: Clone + Menuable> Menu<T> {
if i == self.selected || !elem.is_played() {
let style = if !elem.is_played() {
style::ContentStyle::new()
.foreground(self.panel.colors.bold.0)
.background(self.panel.colors.bold.1)
.with(self.panel.colors.bold.0)
.on(self.panel.colors.bold.1)
.attribute(style::Attribute::Bold)
} else {
style::ContentStyle::new()
.foreground(self.panel.colors.normal.0)
.background(self.panel.colors.normal.1)
.with(self.panel.colors.normal.0)
.on(self.panel.colors.normal.1)
};
self.panel.write_line(
i,
Expand Down Expand Up @@ -197,13 +197,16 @@ impl<T: Clone + Menuable> Menu<T> {
if let Some((title, is_played)) = el_details {
let mut style = style::ContentStyle::new();
if active {
style = style
.foreground(self.panel.colors.highlighted_active.0)
.background(self.panel.colors.highlighted_active.1);
style = style.with(self.panel.colors.highlighted_active.0).on(self
.panel
.colors
.highlighted_active
.1);
} else {
style = style
.foreground(self.panel.colors.highlighted.0)
.background(self.panel.colors.highlighted.1);
style =
style
.with(self.panel.colors.highlighted.0)
.on(self.panel.colors.highlighted.1);
}
style = if is_played {
style.attribute(style::Attribute::NormalIntensity)
Expand All @@ -226,12 +229,12 @@ impl<T: Clone + Menuable> Menu<T> {
if let Some((title, is_played)) = el_details {
let style = if is_played {
style::ContentStyle::new()
.foreground(self.panel.colors.normal.0)
.background(self.panel.colors.normal.1)
.with(self.panel.colors.normal.0)
.on(self.panel.colors.normal.1)
} else {
style::ContentStyle::new()
.foreground(self.panel.colors.bold.0)
.background(self.panel.colors.bold.1)
.with(self.panel.colors.bold.0)
.on(self.panel.colors.bold.1)
.attribute(style::Attribute::Bold)
};
self.panel.write_line(item_y, title, Some(style));
Expand Down
1 change: 1 addition & 0 deletions src/ui/notification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use crossterm::{
cursor,
event::{self, KeyCode},
execute, queue, style,
style::Stylize,
};

use super::AppColors;
Expand Down
7 changes: 4 additions & 3 deletions src/ui/panel.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use std::io;
use std::rc::Rc;

use crossterm::{cursor, queue, style};
use crossterm::style::{self, Stylize};
use crossterm::{cursor, queue};

use super::AppColors;

Expand Down Expand Up @@ -228,8 +229,8 @@ impl Panel {
let content_style = match style {
Some(style) => style,
None => style::ContentStyle::new()
.foreground(self.colors.normal.0)
.background(self.colors.normal.1),
.with(self.colors.normal.0)
.on(self.colors.normal.1),
};
let wrapper = textwrap::wrap(string, self.get_cols() as usize);
for line in wrapper {
Expand Down
5 changes: 3 additions & 2 deletions src/ui/popup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use std::rc::Rc;
use crossterm::{
event::{KeyCode, KeyEvent},
style,
style::Stylize,
};

use super::{AppColors, Menu, Panel, Scroll, UiMsg};
Expand Down Expand Up @@ -239,8 +240,8 @@ impl<'a> PopupWin<'a> {
"Available keybindings:",
Some(
style::ContentStyle::new()
.foreground(self.colors.normal.0)
.background(self.colors.normal.1)
.with(self.colors.normal.0)
.on(self.colors.normal.1)
.attribute(style::Attribute::Underlined),
),
);
Expand Down

0 comments on commit ee0235e

Please sign in to comment.