1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

clipboard: fix clear() on macos

This commit is contained in:
Alexander Medvednikov 2020-11-20 11:58:53 +01:00
parent 7c2c187743
commit 412e2a43e9
3 changed files with 4 additions and 4 deletions

View File

@ -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() {

View File

@ -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;

View File

@ -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