Coder Social home page Coder Social logo

Comments (14)

kyx0r avatar kyx0r commented on July 22, 2024

Hello Chris, thank you for the report.
This is a recent regression due to invalid assumption of vi_mod == 2 redrawing 1 line,
the comment in vi.c isn't absolute in that regard, I'll see how to also mention that in the comment.
Try last commit now, it should work ok.
Also if you find a behavior such as when the cursor is right at the last
character of the line, going into insert and deleting with backspace will delete the last
character in the line instead of deleting the previous character. This is intended behavior.

from nextvi.

clark800 avatar clark800 commented on July 22, 2024

Thanks for the quick response. I tried it and the character gets deleted now, but the cursor still jumps to the previous line rather than going to the first column.

Regarding the other point you made, why is that the intended behavior? It seems inconsistent and it's easy to backspace over the last character using a to enter insert mode. It also differs from vim behavior.

from nextvi.

kyx0r avatar kyx0r commented on July 22, 2024

Hm, I am not sure. Maybe has to do something with the way X key works in normal mode. There was good reason why I implemented it this way. Perhaps now with the current way the source code is laid out there must be a cleaner way to implement this feature without such behaviors. I shall have a look.

from nextvi.

kyx0r avatar kyx0r commented on July 22, 2024

Ok, i've pushed a fix for the a command, and also added s command because it seems to work fine with that for the most part. The problem is that we are reusing the X and x keybind functionality to achieve this feature and it's not enough to accomodate for all the cases of cursor being at the end of the line or at the beginning, but in my opinion it's actually small price to pay since it works fine in most general use cases now.

(I tend to (re)force push last few commits if I make a mistake, so make sure to reset last few commits before pull if
you have to)

from nextvi.

clark800 avatar clark800 commented on July 22, 2024

Looks like it's still jumping from column 2 to the previous line rather than backspacing to column 1.

For the second issue, I'm seeing strange behavior. If I type from insert mode: 'a', 'b', 'c', escape, 'a', backspace, it shows "ac" rather than "ab" and the cursor jumps two columns on the backspace. And when using 'i' to enter insert mode backspace doesn't move the cursor the first time.

from nextvi.

kyx0r avatar kyx0r commented on July 22, 2024

Yeah that's the issue I was talking about. It would do that on line endings. It is what it is :(

from nextvi.

kyx0r avatar kyx0r commented on July 22, 2024

It basically does the same thing a command $X would do or $x. We don't have any means of aserting those cases since command a moves forward to a '\n' character. Builing a specialized solution to solve those edge cases may be too much trouble adding lots of new lines of code which a project like this tries to avoid.

from nextvi.

kyx0r avatar kyx0r commented on July 22, 2024

I'll see maybe I add if statement just for those, since when we at the end xoff is bigger than k-1 and we can catch that by reversing the condition for next instruction. Try the last commit, let me know if this helps.

from nextvi.

clark800 avatar clark800 commented on July 22, 2024

Cool, append-backspace works perfectly now.

Remaining issues:

  1. Insert mode: 'x', enter, 'x', enter, backspace, backspace - cursor jumps from line 2 column 2 to line 1 column 2 instead of line 2 column 1.
  2. Insert mode: 'a', 'b', 'c', escape, 'i', backspace - cursor does not move, should delete the 'b' leaving "ac" (like vim).

from nextvi.

kyx0r avatar kyx0r commented on July 22, 2024

Actually append backspace still have an edge case, try doing:

inset mode: 'a' 'b' 'c' escape, h (to move left), a (enters insert), backspace

this will delete 'c' instead of 'b'

  1. The issue with colums is interesting but I think it only happens when there is 1 character only in the line, I'll take a look.
  2. Issue with last char and 'i' don't know if I will ever fix

You see the problem may also be that you fix 1 thing but break other keybind. That code has to handle lots of
situations.

from nextvi.

kyx0r avatar kyx0r commented on July 22, 2024

Hello Chris, I think commit 87ef32f fixes some of the edge cases including 1.

I tested it somewhat, please report if you find anything else odd.

from nextvi.

kyx0r avatar kyx0r commented on July 22, 2024

hm. it only fixes the problem if there is space on line above, which would delete wrong character after join. to fix 1. I still have to see what gives.

from nextvi.

kyx0r avatar kyx0r commented on July 22, 2024

Ok I don't know, there may still be some edge cases but at least for now none too bad that I see right now. This thing is a pain in the ass to debug but at least with the last few patches I was able to get rid of a lot of lines of code from that implementation. Seems like the join point does not work correctly with c command in some cases (but its not like it ever worked correctly to begin with)

from nextvi.

clark800 avatar clark800 commented on July 22, 2024

Nice, looks like the backspacing across lines issue is fixed.

from nextvi.

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.