Code Monkey home page Code Monkey logo

Comments (7)

shmerl avatar shmerl commented on May 26, 2024

Btw, I just tested vim-oscyank and it doesn't have that issue!

The way I mapped it there:

xnoremap <C-c> :OSCYank<CR>

from nvim-osc52.

ojroques avatar ojroques commented on May 26, 2024

Does it happen with konsole only? Also, what is the value of your selection option (:set selection?)?

from nvim-osc52.

shmerl avatar shmerl commented on May 26, 2024

:set selection shows selection=exclusive.

Here is my config:

set selection=exclusive
set virtualedit=block,onemore

I think I tried it in kitty, but there it's even more broken overall, so I didn't dig much into that.

May be virtualedit setting affects it?

from nvim-osc52.

ojroques avatar ojroques commented on May 26, 2024

On my side it works as expected with your settings. Can you try with set selection=inclusive and see if it works?

from nvim-osc52.

shmerl avatar shmerl commented on May 26, 2024

With inclusive it actually works correctly.

So I think what happens, with exclusive it ignores the selection length and copies from the beginning of the selection to the current position of the cursor including it, even though the latter isn't selected (becasue of exclusive setting). So that produces one character more than needed.

from nvim-osc52.

shmerl avatar shmerl commented on May 26, 2024

I see the code doing this:

  -- Retrieve text
  vim.go.clipboard = ''
  vim.go.selection = 'inclusive'
  local command = fmt('keepjumps normal! %s', commands[mode][type])
  vim.cmd(fmt('silent execute "%s"', command))
  local text = vim.fn.getreg('"')

  -- Restore user settings
  vim.go.clipboard = clipboard
  vim.go.selection = selection

This looks like it ignores it whether selection setting was exclusive and treats everything as inclusive?

from nvim-osc52.

shmerl avatar shmerl commented on May 26, 2024

Yeah, just confirmed it. Commenting out vim.go.selection = 'inclusive' makes it work correctly for me!

So I think the code should make a distinction whether selection was exclusive or not with some check.

from nvim-osc52.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.