Display colon-delimited emoji in nicks
This commit is contained in:
parent
9f7c1fb9c0
commit
16011a267d
6 changed files with 25 additions and 12 deletions
|
|
@ -1,5 +1,5 @@
|
|||
use crossterm::style::ContentStyle;
|
||||
use euphoxide::conn::Joined;
|
||||
use toss::styled::Styled;
|
||||
use toss::terminal::Terminal;
|
||||
|
||||
use crate::euph::{self, Room};
|
||||
|
|
@ -17,7 +17,7 @@ pub fn new(joined: Joined) -> EditorState {
|
|||
pub fn widget(editor: &EditorState) -> BoxedWidget {
|
||||
let editor = editor
|
||||
.widget()
|
||||
.highlight(|s| Styled::new(s, euph::nick_style(s)));
|
||||
.highlight(|s| euph::style_nick_exact(s, ContentStyle::default()));
|
||||
Popup::new(Padding::new(editor).left(1))
|
||||
.title("Choose nick")
|
||||
.inner_padding(false)
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
use std::borrow::Cow;
|
||||
use std::iter;
|
||||
|
||||
use crossterm::style::{Color, ContentStyle, Stylize};
|
||||
|
|
@ -118,7 +119,7 @@ fn render_row(list: &mut List<SessionId>, session: &HalfSession, own_session: &S
|
|||
let name = "lurk";
|
||||
let style = ContentStyle::default().grey();
|
||||
let style_inv = ContentStyle::default().black().on_grey();
|
||||
(name, style, style_inv, style_inv)
|
||||
(Cow::Borrowed(name), style, style_inv, style_inv)
|
||||
} else {
|
||||
let name = &session.name as &str;
|
||||
let (r, g, b) = euph::nick_color(name);
|
||||
|
|
@ -126,7 +127,7 @@ fn render_row(list: &mut List<SessionId>, session: &HalfSession, own_session: &S
|
|||
let style = ContentStyle::default().bold().with(color);
|
||||
let style_inv = ContentStyle::default().bold().black().on(color);
|
||||
let perms_style_inv = ContentStyle::default().black().on(color);
|
||||
(name, style, style_inv, perms_style_inv)
|
||||
(euph::EMOJI.replace(name), style, style_inv, perms_style_inv)
|
||||
};
|
||||
|
||||
let perms = if session.is_staff {
|
||||
|
|
@ -145,7 +146,9 @@ fn render_row(list: &mut List<SessionId>, session: &HalfSession, own_session: &S
|
|||
" "
|
||||
};
|
||||
|
||||
let normal = Styled::new_plain(owner).then(name, style).then_plain(perms);
|
||||
let normal = Styled::new_plain(owner)
|
||||
.then(&name, style)
|
||||
.then_plain(perms);
|
||||
let selected = Styled::new_plain(owner)
|
||||
.then(name, style_inv)
|
||||
.then(perms, perms_style_inv);
|
||||
|
|
|
|||
|
|
@ -309,8 +309,8 @@ impl EuphRoom {
|
|||
if nick.is_empty() {
|
||||
info.then_plain(", present without nick")
|
||||
} else {
|
||||
let nick_style = euph::nick_style(nick);
|
||||
info.then_plain(", present as ").then(nick, nick_style)
|
||||
info.then_plain(", present as ")
|
||||
.and_then(euph::style_nick(nick, ContentStyle::default()))
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue