diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2019-10-17 04:24:23 -0400 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2019-10-17 01:24:23 -0700 |
commit | 0785f8e8b11b2fa290cfbc0604d570f49b954ba6 (patch) | |
tree | ec9cd655c7a85a533d03240965df22c16f6dce23 /src/nvim/cursor.c | |
parent | 94bda2fec8d03cdbea442d70c41186f0aa039786 (diff) | |
download | rneovim-0785f8e8b11b2fa290cfbc0604d570f49b954ba6.tar.gz rneovim-0785f8e8b11b2fa290cfbc0604d570f49b954ba6.tar.bz2 rneovim-0785f8e8b11b2fa290cfbc0604d570f49b954ba6.zip |
vim-patch:8.1.2140: "gk" and "gj" do not work correctly in number column #11208
Problem: "gk" and "gj" do not work correctly in number column.
Solution: Allow for a negative "curswant". (Zach Wegner, closes vim/vim#4969)
https://github.com/vim/vim/commit/ceba3dd5187788e09f65bd41b07b40f6f9aab953
Diffstat (limited to 'src/nvim/cursor.c')
-rw-r--r-- | src/nvim/cursor.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/nvim/cursor.c b/src/nvim/cursor.c index f2b3cfe690..036ae32589 100644 --- a/src/nvim/cursor.c +++ b/src/nvim/cursor.c @@ -93,11 +93,12 @@ int coladvance(colnr_T wcol) static int coladvance2( pos_T *pos, - bool addspaces, /* change the text to achieve our goal? */ - bool finetune, /* change char offset for the exact column */ - colnr_T wcol /* column to move to */ + bool addspaces, // change the text to achieve our goal? + bool finetune, // change char offset for the exact column + colnr_T wcol_arg // column to move to (can be negative) ) { + colnr_T wcol = wcol_arg; int idx; char_u *ptr; char_u *line; @@ -165,6 +166,7 @@ static int coladvance2( if (virtual_active() && addspaces + && wcol >= 0 && ((col != wcol && col != wcol + 1) || csize > 1)) { /* 'virtualedit' is set: The difference between wcol and col is * filled with spaces. */ @@ -244,8 +246,9 @@ static int coladvance2( mark_mb_adjustpos(curbuf, pos); } - if (col < wcol) + if (wcol < 0 || col < wcol) { return FAIL; + } return OK; } |