From 412e2a43e9c93c8c93588c2aeb46dd0c26fc5764 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Fri, 20 Nov 2020 11:58:53 +0100 Subject: [PATCH] clipboard: fix clear() on macos --- vlib/clipboard/clipboard_darwin.c.v | 2 +- vlib/clipboard/clipboard_darwin.m | 2 +- vlib/clipboard/clipboard_test.v | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/vlib/clipboard/clipboard_darwin.c.v b/vlib/clipboard/clipboard_darwin.c.v index 8e5e368635..fcb756ada3 100644 --- a/vlib/clipboard/clipboard_darwin.c.v +++ b/vlib/clipboard/clipboard_darwin.c.v @@ -31,7 +31,7 @@ fn (cb &Clipboard) check_availability() bool { fn (mut cb Clipboard) clear() { cb.foo = 0 cb.set_text('') - #[cb->pb clearContents]; + //#[cb->pb clearContents]; } fn (mut cb Clipboard) free() { diff --git a/vlib/clipboard/clipboard_darwin.m b/vlib/clipboard/clipboard_darwin.m index 39bd242402..cabc744cec 100644 --- a/vlib/clipboard/clipboard_darwin.m +++ b/vlib/clipboard/clipboard_darwin.m @@ -16,7 +16,7 @@ bool darwin_set_pasteboard_text(void* _pb, string text) { NSString *ns_clip = [[ NSString alloc ] initWithBytesNoCopy:text.str length:text.len encoding:NSUTF8StringEncoding freeWhenDone: false]; [pb declareTypes:[NSArray arrayWithObject:NSStringPboardType] owner:nil]; bool ret = [pb setString:ns_clip forType:NSStringPboardType]; - [ns_clip release]; + //[ns_clip release]; int serial = [pb changeCount]; //OSAtomicCompareAndSwapLong(cb.last_cb_serial, serial, &cb.last_cb_serial); return ret; diff --git a/vlib/clipboard/clipboard_test.v b/vlib/clipboard/clipboard_test.v index 91a4184cd1..3c507cc3e3 100644 --- a/vlib/clipboard/clipboard_test.v +++ b/vlib/clipboard/clipboard_test.v @@ -5,9 +5,9 @@ fn run_test(is_primary bool) { if !cb.is_available() { return } - //assert cb.check_ownership() == false + assert cb.check_ownership() == false assert cb.copy('I am a good boy!') == true - //assert cb.check_ownership() == true + // assert cb.check_ownership() == true TODO assert cb.paste() == 'I am a good boy!' cb.clear_all() assert cb.paste().len <= 0