fix copying multi-character emojis

This commit is contained in:
lelgenio 2023-08-31 16:24:08 -03:00
parent 92cfb1c0f7
commit 60f638476a

View file

@ -41,7 +41,7 @@ fn main() {
} }
} }
fn pick_emoji_dmenu(c: &[String], args: &Args) -> char { fn pick_emoji_dmenu(c: &[String], args: &Args) -> String {
let child_stdout = if args.copy { let child_stdout = if args.copy {
std::process::Stdio::piped() std::process::Stdio::piped()
} else { } else {
@ -57,17 +57,17 @@ fn pick_emoji_dmenu(c: &[String], args: &Args) -> char {
write_emojis_to_stdout(args, stdin); write_emojis_to_stdout(args, stdin);
if !args.copy { if !args.copy {
return ' '; return " ".to_string();
} }
let output = child.wait_with_output().unwrap(); let output = child.wait_with_output().unwrap();
let out = String::from_utf8_lossy(&output.stdout) let output = String::from_utf8_lossy(&output.stdout);
.chars() let out = output
.take(1) .split(':')
.next() .next()
.unwrap_or_else(|| std::process::exit(1)); .unwrap_or_else(|| std::process::exit(1));
out out.to_string()
} }
fn send_to_clipboard(out: String) { fn send_to_clipboard(out: String) {