headers-vy icon indicating copy to clipboard operation
headers-vy copied to clipboard

Section comment is not registering in the clipboard on Ubuntu 24

Open s3bc40 opened this issue 11 months ago • 0 comments

Hey :wave:

I know this is an old repo, but it was still presented at the Cyfrin course on Vyper. And since I am learning Rust alongside, I wanted to use this first to make clean comment section.

But it would not save it on my clipboard, rather it was deleting what I had previously inside. So I have forked the repo and ran some tests (even though I am beginning in rust). I have gone to the rust-clipboard repo to see if there is an issue related.

I found this solution related to what I experienced:

use clipboard::ClipboardProvider;
use clipboard::ClipboardContext;

fn main() {
    let mut ctx: ClipboardContext = ClipboardProvider::new().unwrap();
    ctx.set_contents("My name is Pablo".to_owned()).unwrap();
    ctx.get_contents(); --> HERE IS WHAT IS MISSING
}

That is a strange behavior, but apparently we need to call ctx.get_contents(); to get it inside our clipboard.

I'll make a PR with my forked fix tested locally if it can help!

s3bc40 avatar Jan 10 '25 11:01 s3bc40