Comments (14)
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.
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.
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.
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.
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.
Yeah that's the issue I was talking about. It would do that on line endings. It is what it is :(
from nextvi.
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.
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.
Cool, append-backspace works perfectly now.
Remaining issues:
- 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.
- Insert mode: 'a', 'b', 'c', escape, 'i', backspace - cursor does not move, should delete the 'b' leaving "ac" (like vim).
from nextvi.
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'
- 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.
- 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.
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.
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.
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.
Nice, looks like the backspacing across lines issue is fixed.
from nextvi.
Related Issues (20)
- segfault when trying to edit file that doesnt exist or is a directory HOT 3
- stdin pipe breaks all syntax highlighting HOT 1
- Issues with stdin_pipe HOT 14
- Is gf bind in normal mode that edits the file whose address is under the cursor, a thing in Nextvi? HOT 6
- arrowkeys_normal.patch shouldn't exit insert mode HOT 24
- Remove variable length arrays HOT 14
- arrowkeys_insert: the first time entering command mode, the command bar is broken until you type something HOT 1
- gcc warning HOT 2
- visual mode equivalent? HOT 2
- ec_closebuf segfaults if it is the only remaining buffer HOT 1
- Float without leading zero HOT 2
- a way to change how big tabs are HOT 1
- soft line wrap? HOT 1
- implementing vim-like dw HOT 3
- stdin_pipe: lockup if stdin is terminal HOT 5
- Skip command confirmation when only one line HOT 1
- arrowkeys_insert: cursor position is wrong when moving up or down a line after typing something HOT 6
- Segmentation fault HOT 3
- Edge case of missing filename HOT 3
- ex "!" HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nextvi.