Re: [code] ctrl-c frequently doesn't work on Windows.

From: Danny MacMillan <foicica.att.nekulturny.org>
Date: Sun, 22 Oct 2017 15:29:12 -0600

On 2017-10-22 14:58, Robert Gieseke wrote:
> Am 22/10/17 um 22:47 schrieb Danny MacMillan:
>> -- busy-waiting is terrible but I couldn't find a ready-to-use sleep
>> function
>
> There is `timeout` in Textadept
>
> https://foicica.com/textadept/api.html#timeout

Thanks for letting me know about this. I'm not sure how you're proposing
I would use that as a delay. It doesn't seem to block at the call site,
so it won't delay returning from keys.cc which is I think what is making
this work. I think the delay needs to be after the call to
buffer.copy(), not before.

But maybe I'm just not seeing what you're getting at. I tried changing
my sleep function to this, and it definitely isn't working. The
ui.statusbar_text assignments are just there so I can see whether it's
blocking. If I call sleep(5) I see "after" in the statusbar for 5
seconds, then "during". I assume "before" is printed also but it's
faster than I can perceive.

function sleep(s)
   ui.statusbar_text = "before"
   timeout(s, function()
     ui.statusbar_text = "during"
     return false
   end)
   ui.statusbar_text = "after"
end

>> With this in my init.lua, I haven't (yet) had a clipboard issue.
>
> That's great to hear. One could maybe even automate the testing by
> (randomly) selecting some text, copying it and then reading the actual
> Windows clipboard with something like this
>
> https://stackoverflow.com/questions/6832203/access-clipboard-in-windows-batch-file/1574706
>
> From Textadept you could use `spawn`
>
> https://foicica.com/textadept/api.html#spawn
>
> This could also be an alternative to relying on `ui.clipboard_text`
> which didn't work.

It's not a bad idea, but I tried using the VBScript sleep function from
the page I linked before I landed on the busy-waiting solution and the
time it takes to launch is significant. Although I guess for testing it
would be fast enough.

-- 
Dan
-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Sun 22 Oct 2017 - 17:29:12 EDT

This archive was generated by hypermail 2.2.0 : Mon 23 Oct 2017 - 06:42:27 EDT