t9md / atom-vim-mode-plus

vim-mode improved
https://atom.io/packages/vim-mode-plus
MIT License
1.4k stars 111 forks source link

Should cache cursor column number and not update that cache when only scrolling up or down (see example) #1135

Open collinalexbell opened 4 years ago

collinalexbell commented 4 years ago

For example, take the following text

aaaaaa
bbb

Imagine the cursor is over the last a in the first line and then I move the cursor down. It will then be on the last b in the second line. If I move the cursor back up to the 1st line, it should remember that I was at the last a and jump back to it (this is how it would work in vim). Instead it goes to the 3rd a.

Essentially, every time the cursor moves left or right, the column # gets saved. If the cursor moves down or up to a line that has less columns than that saved column number, it simply goes to the last column available, but the cache still remains at the larger number. That way, if the cursor moves back up to a line that has columns >= cached_column, it will jump back to the cache column.

Sorry if this is confusing. Just try the example I posted in both vim and atom to see what I am talking about.