Giter Site home page Giter Site logo

Comments (4)

nightwing avatar nightwing commented on July 29, 2024 1

@Opisek seems to be a bug in EditorSelection.range which creates a cursor that is displayed as a range with assoc=1, but behaves as one with assoc=-1

from codemirror-vim.

Opisek avatar Opisek commented on July 29, 2024

For clarification, this only happens when the line is wrapped, correct?

from codemirror-vim.

apotenza92 avatar apotenza92 commented on July 29, 2024

Yes that's correct. Apologies I should've mentioned that.

from codemirror-vim.

Opisek avatar Opisek commented on July 29, 2024

I'm afraid this is a CodeMirror issue, rather than CodeMirror Vim.

The unexpected behaviour is generated here and does exactly what described in the issue.

Example:

  • My lines are 100 characters long.
  • My first line contains a 100 letters.
  • My second line contains 200 letters and wraps.
  • Let the cursor be on the first character of the third line (wrapped second line).
  • The cursor position is 200.
  • Calling CodeMirror's moveVertically will return 0 instead of 100.

I am unsure if this is the intended behaviour of the relevant function. A monkey-patch on our end would be to artificially move the cursor one character to the right and then back to the left, but I imagine that would introduce even more bugs.

I believe this is the relevant function upstream.

Update:
I am unable to reproduce this issue in raw CodeMirror, wherefore I haven't opened an issue there yet. Seemingly equal calls to that function on the same version of CodeMirror View result in different results when I press arrow up in CodeMirror vs gk in CodeMirror Vim.
Will continue to investigate when I find some time, but I'm momentarily out of ideas.

from codemirror-vim.

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.