New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clipboard: avoid pathology during :redir #7193

Merged
merged 3 commits into from Aug 20, 2017

Conversation

Projects
None yet
1 participant
@justinmk
Member

justinmk commented Aug 20, 2017

This was quite an adventure.

redir_write():

  • This is a "batch" operation which was not yet covered by
    start_batch_changes()
    This was irrelevant; the problem actually is that :redir @+> is an explicit register (as opposed to "implicit" clipboard target with clipboard=unnamed[plus]). We can't go around second-guessing explicit register writes, so there is little we can do to avoid invoking the clipboard provider once-per-line during :redir @+>.

adjust_clipboard_name():

  • msg() and friends during :redir will, of course, cause redir_write()
    to try to capture that message, which causes recursion.
  • EMSG() here is trouble: if it interrupts :redir it is a mess.
    Rather than deal with the mess, show a non-error message.

Closes #7182
Closes #7184
ref #6048

justinmk added some commits Aug 20, 2017

clipboard: avoid error flood during :redir
redir_write():
- This is a "batch" operation which was not yet covered by
  start_batch_changes()

adjust_clipboard_name():
- msg() and friends during :redir will, of course, cause redir_write()
  to try to capture that message, which causes recursion.
- EMSG() here is trouble: if it interrupts :redir it is a mess.
  Rather than deal with the mess, show a non-error message.

closes #7182
closes #7184
closes #7183
ref #6048
ref #7032
clipboard: remove start_batch_changes() in redir_write()
start_batch_changes() doesn't avoid invoking the clipboard
once-per-line, because the loop is actually in ex_echo(), which calls
redir_write() for each message. But we've already entered
start_batch_changes() by then, so that was never the problem.

    redir_write at /home/vagrant/old.neovim/build/../src/nvim/message.c:2523
    msg_puts_attr_len at /home/vagrant/old.neovim/build/../src/nvim/message.c:1600
    msg_outtrans_len_attr at /home/vagrant/old.neovim/build/../src/nvim/message.c:1221
    ex_echo at /home/vagrant/old.neovim/build/../src/nvim/eval.c:19433
    do_one_cmd at /home/vagrant/old.neovim/build/../src/nvim/ex_docmd.c:2242

Trying to defer _explicit_ clipboard updates is difficult.
    :redir @+ | silent echo system('cat foo') | redir END
is essentially equivalent to:
    for l in readfile('foo')
        let @+ .= l
    endfor
We cannot make judgements about when to ignore a script's bad decisions.
start_batch_changes() only works around the case of clipboard=unnamed,
i.e. _implicit_ clipboard updates (`:g/foo/d`).  Not explicit
assignment.
clipboard: test g:clipboard validation, fix a bug
Also fix `:help foo` highlighting in health.vim

@justinmk justinmk merged commit 8d1ccb6 into neovim:master Aug 20, 2017

3 of 4 checks passed

QuickBuild Build pr-7193 finished with status FAILED
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls First build on master at 76.463%
Details

@justinmk justinmk deleted the justinmk:cb-pathology branch Aug 20, 2017

justinmk added a commit to justinmk/neovim that referenced this pull request Nov 8, 2017

NVIM v0.2.1
FEATURES:
0e873a3 Lua(Jit) built-in neovim#4411
5b32bce Windows: `:terminal` neovim#7007
7b0ceb3 UI/API: externalize cmdline neovim#7173
b67f58b UI/API: externalize wildmenu neovim#7454
b23aa1c UI: 'winhighlight' neovim#6597
17531ed UI: command-line coloring (`:help input()-highlight`) neovim#6364
244a1f9 API: execute lua directly from the remote api neovim#6704
45626de API: `get_keymap()` neovim#6236
db99982 API: `nvim_get_hl_by_name()`, `nvim_get_hl_by_id()` neovim#7082
dc68538 menu_get() function neovim#6322
9db42d4 :cquit : take an error code argument neovim#7336
9cc185d job-control: serverstart(): support ipv6 neovim#6680
1b7a9bf job-control: sockopen() neovim#6594
6efe84a clipboard: fallback to tmux clipboard neovim#6894
6016ac2 clipboard: customize clipboard with `g:clipboard` neovim#6030
3a86dd5 ruby: override ruby host via `g:ruby_host_prog` neovim#6841
16cce1a debug: $NVIM_LOG_FILE neovim#6827
0cba3da `:checkhealth` built-in, validates $VIMRUNTIME neovim#7399

FIXES:
105d680 TUI: more terminals, improve scroll/resize neovim#6816
cb912a3 :terminal : handle F1-F12, other keys neovim#7241
619838f inccommand: improve performance neovim#6949
04b3c32 inccommand: Fix matches for zero-width neovim#7487
60b1e8a inccommand: multiline, other fixes neovim#7315
f1f7f3b inccommand: Ignore leading modifiers in the command neovim#6967
1551f71 inccommand: fix 'gdefault' lockup neovim#7262
6338199 API: bufhl: support creating new groups neovim#7414
541dde3 API: allow K_EVENT during operator-pending
8c732f7 terminal: adjust for 'number' neovim#7440
5bec946 UI: preserve wildmenu during jobs/events neovim#7110
c349083 UI: disable 'lazyredraw' during ui_refresh. neovim#6259
51808a2 send FocusGained/FocusLost event instead of pseudokey neovim#7221
133f8bc shada: preserve unnamed register on restart neovim#4700
1b70a1d shada: avoid assertion on corrupt shada file neovim#6958
9f534f3 mksession: Restore tab-local working directory neovim#6859
de1084f fix buf_write() crash neovim#7140
7f76986 syntax: register 'Normal' highlight group neovim#6973
6e7a8c3 RPC: close channel if stream was closed neovim#7081
85f3084 clipboard: disallow recursion; show hint only once neovim#7203
8d1ccb6 clipboard: performance, avoid weird edge-cases neovim#7193
01487d4 'titleold' neovim#7358
01e53a5 Windows: better path-handling, separator (slash) hygiene neovim#7349
0f2873c Windows: multibyte startup arguments neovim#7060

CHANGES:
9ff0cc7 :terminal : start in normal-mode neovim#6808
032b088 lower priority of 'cursorcolumn', 'colorcolumn' neovim#7364
2a3bcd1 RPC: Don't delay notifications when request is pending neovim#6544
023f67c :terminal : Do not change 'number', 'relativenumber' neovim#6796
1ef2d76 socket.c: Disable Nagle's algorithm on TCP sockets neovim#6915
6720fe2 help: `K` tries Vim help instead of manpage neovim#3104
7068370 help, man.vim: change "outline" map to `gO` neovim#7405

@justinmk justinmk referenced this pull request Nov 8, 2017

Merged

NVIM v0.2.1 #7505

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment