Skip to content
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

Fix bug where clipboard would be polluted when showing Services menu #1300

Merged
merged 2 commits into from
Oct 3, 2022

Commits on Oct 2, 2022

  1. Fix bug where clipboard would be polluted when showing Services menu

    Previously, whenever the user selects some text in MacVim, and then
    bring up the Services menu (either by right-clicking on the selection,
    or go to MacVim -> Services), MacVim will copy the selected text to the
    system clipboard, which is quite an unexpected behavior. Fix that here.
    
    Part of the issue is that Vim has built-in ways to convert the selected
    range to a single copyable text, while managing complexities of dealing
    with blockwise/linewise modes. Previous implementation in MacVim was
    lazy in that it just invoked those code, but the side effect was that it
    would also copy the text to the system clipboard and pollute Vim's star
    register as well. This was quite undesirable because the user has not
    done anything other than opening a menu and wouldn't have expected the
    system clipboard or the Vim registers to have changed.
    
    In this fix, we unfortunately had to do a little bit more copy-pasting
    to extract the useful bits so we can copy the text to a register (but
    not system clipboard), invoke the code to convert the register to
    clipboard-happy text, restore the register, and then move on. A little
    annoying but better than having the unintuitive / annoying behaveior
    from before, and this way we don't have to do too much intrusive
    refactoring of upstream Vim code as well.
    ychin committed Oct 2, 2022
    Configuration menu
    Copy the full SHA
    8fda035 View commit details
    Browse the repository at this point in the history

Commits on Oct 3, 2022

  1. Fix code to use getreg() instead

    I just missed the fact that getreg() also works and I don't need to hack
    to use clip_convert_selection() and the mod on it. This is kind of...
    odd, because clip_convert_selection() is essentially doing the same
    thing as getreg() with *very* minor differences. You would hope that
    would be consolidated and refactored into a single function, but of
    course not.
    
    Also cleaned up some comments to make it clear that evaluateExpression
    probably would have worked except for the autocmd blocking part.
    ychin committed Oct 3, 2022
    Configuration menu
    Copy the full SHA
    f45f939 View commit details
    Browse the repository at this point in the history