diff options
| author | Josh Rahm <joshuarahm@gmail.com> | 2024-03-09 15:00:41 -0700 |
|---|---|---|
| committer | Josh Rahm <joshuarahm@gmail.com> | 2024-03-09 15:00:41 -0700 |
| commit | 7a7f497b483cd65e340064f23ed1c73425ecba0a (patch) | |
| tree | d5c99ea22a1e10300d06165f8ac96df6b0dc59e1 /runtime/plugin/osc52.lua | |
| parent | 1b7b916b7631ddf73c38e3a0070d64e4636cb2f3 (diff) | |
| parent | ade1b12f49c3b3914c74847d791eb90ea90b56b7 (diff) | |
| download | rneovim-7a7f497b483cd65e340064f23ed1c73425ecba0a.tar.gz rneovim-7a7f497b483cd65e340064f23ed1c73425ecba0a.tar.bz2 rneovim-7a7f497b483cd65e340064f23ed1c73425ecba0a.zip | |
Merge remote-tracking branch 'upstream/master' into aucmd_textputpost
Diffstat (limited to 'runtime/plugin/osc52.lua')
| -rw-r--r-- | runtime/plugin/osc52.lua | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/runtime/plugin/osc52.lua b/runtime/plugin/osc52.lua index 374b70066f..7ffd64342e 100644 --- a/runtime/plugin/osc52.lua +++ b/runtime/plugin/osc52.lua @@ -1,12 +1,20 @@ -local tty = vim.iter(vim.api.nvim_list_uis()):any(function(ui) - return ui.chan == 1 and ui.stdout_tty -end) +local tty = false +for _, ui in ipairs(vim.api.nvim_list_uis()) do + if ui.chan == 1 and ui.stdout_tty then + tty = true + break + end +end if not tty or vim.g.clipboard ~= nil or vim.o.clipboard ~= '' or not os.getenv('SSH_TTY') then return end -require('vim.termcap').query('Ms', function(cap, seq) +require('vim.termcap').query('Ms', function(cap, found, seq) + if not found then + return + end + assert(cap == 'Ms') -- Check 'clipboard' and g:clipboard again to avoid a race condition @@ -16,7 +24,7 @@ require('vim.termcap').query('Ms', function(cap, seq) -- If the terminal reports a sequence other than OSC 52 for the Ms capability -- then ignore it. We only support OSC 52 (for now) - if not seq:match('^\027%]52') then + if not seq or not seq:match('^\027%]52') then return end |