https://github.com/vim/vim/pull/20216
(3 files)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
thanks
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
@chrisbra commented on this pull request.
In runtime/pack/dist/opt/osc52/autoload/osc52.vim:
> # Check if user has indicated that the terminal does not support OSC 52 paste
# (or has disabled it)
if get(g:, 'osc52_disable_paste', 0)
return ("c", [])
endif
+ if loop_timerid != -1
+ timer_stop(loop_timerid)
+ loop_timerid = -1
+ endif
+ if !returned_to_loop
+ returned_to_loop = true
+ # This will result in the register being unchanged
+ return null
+ endif
Do we need those 2 ifs? Wouldn't this work as well? (which I think means we do not need the returned_to_loop variable)?
if loop_timerid != -1
timer_stop(loop_timerid)
loop_timerid = -1
# This will result in the register being unchanged
return null
endif
In runtime/pack/dist/opt/osc52/autoload/osc52.vim:
> @@ -61,6 +75,14 @@ export def Paste(reg: string): tuple<string, list<string>>
endif
endtry
+ # A TextPutPost autocmd may cause this function to be called twice, which is
+ # technically intended behaviour, however it is not necessary for this plugin.
+ # To prevent this, return immediately if we have not returned back to the main
+ # loop since the last "paste" call.
+ loop_timerid = timer_start(0, (_) => {
+ returned_to_loop = true
+ })
This is a bit tricky, because the behaviour relies on the fact that the timer only triggers once Vim is in the main event loop. It confused me a bit, because I was looking for a loop inside the osc52 plugin.
So together with the above change, wouldn't this work?
loop_timerid = timer_start(0, (_) => { loop_timerid = -1 })
In runtime/pack/dist/opt/osc52/autoload/osc52.vim:
> @@ -61,6 +75,14 @@ export def Paste(reg: string): tuple<string, list<string>>
endif
endtry
+ # A TextPutPost autocmd may cause this function to be called twice, which is
+ # technically intended behaviour, however it is not necessary for this plugin.
+ # To prevent this, return immediately if we have not returned back to the main
+ # loop since the last "paste" call.
+ loop_timerid = timer_start(0, (_) => {
+ returned_to_loop = true
+ })
Or perhaps of using a timer, we can use the SafeState autocommand? Something like this?
# Re-entry detected: bail without re-querying the terminal. if loop_pending loop_pending = false return null endif autocmd SafeState * ++once loop_pending = false
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
@64-bitman pushed 1 commit.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()