mirror of
https://github.com/msfjarvis/clipboard-substitutor
synced 2025-08-14 18:57:02 +05:30
refactor: use tracing's formatting machinery
This commit is contained in:
parent
487e8eadbb
commit
8003246afd
1 changed files with 1 additions and 8 deletions
|
@ -22,7 +22,7 @@ impl<'a> ClipboardHandler for Handler<'a> {
|
|||
.find(|subst| subst.matcher.check_match(&contents))
|
||||
{
|
||||
if subst.name.is_empty().not() {
|
||||
debug!("{}: matched on {}...", &subst.name, truncate(&contents, 40));
|
||||
debug!(?subst.name, ?contents);
|
||||
}
|
||||
let result = subst.action.apply_action(&contents);
|
||||
if let Err(e) = self.ctx.set_contents(result) {
|
||||
|
@ -39,13 +39,6 @@ impl<'a> ClipboardHandler for Handler<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
fn truncate(s: &str, max_chars: usize) -> &str {
|
||||
match s.char_indices().nth(max_chars) {
|
||||
None => s,
|
||||
Some((idx, _)) => &s[..idx],
|
||||
}
|
||||
}
|
||||
|
||||
pub fn monitor(config: Replacements<'_>) {
|
||||
let ctx = ClipboardContext::new().expect("Failed to acquire clipboard");
|
||||
let handler = Handler { ctx, config };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue