diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-12-19 08:01:05 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-19 08:01:05 +0800 |
commit | 1cf51a07a6bfb827efc36911cd018da3a3cb863b (patch) | |
tree | 0f7305da805ae69622bcfd5f530b7a6ea5cac812 | |
parent | 80f75d063d2fd2fabf0584a0167920af647f6e9e (diff) | |
download | rneovim-1cf51a07a6bfb827efc36911cd018da3a3cb863b.tar.gz rneovim-1cf51a07a6bfb827efc36911cd018da3a3cb863b.tar.bz2 rneovim-1cf51a07a6bfb827efc36911cd018da3a3cb863b.zip |
fix(api): don't set coladd of mark (#26648)
-rw-r--r-- | src/nvim/api/private/helpers.c | 2 | ||||
-rw-r--r-- | test/functional/api/buffer_spec.lua | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/nvim/api/private/helpers.c b/src/nvim/api/private/helpers.c index 70e63d0ad5..23ec815346 100644 --- a/src/nvim/api/private/helpers.c +++ b/src/nvim/api/private/helpers.c @@ -1044,7 +1044,7 @@ bool set_mark(buf_T *buf, String name, Integer line, Integer col, Error *err) } } assert(INT32_MIN <= line && line <= INT32_MAX); - pos_T pos = { (linenr_T)line, (int)col, (int)col }; + pos_T pos = { (linenr_T)line, (int)col, 0 }; res = setmark_pos(*name.data, &pos, buf->handle, NULL); if (!res) { if (deleting) { diff --git a/test/functional/api/buffer_spec.lua b/test/functional/api/buffer_spec.lua index b618bf0e6c..b89101a5e7 100644 --- a/test/functional/api/buffer_spec.lua +++ b/test/functional/api/buffer_spec.lua @@ -1990,11 +1990,13 @@ describe('api/buf', function() curbufmeths.set_lines(-1, -1, true, {'a', 'bit of', 'text'}) eq(true, curbufmeths.set_mark('z', 1, 1, {})) eq({1, 1}, curbufmeths.get_mark('z')) + eq({0, 1, 2, 0}, funcs.getpos("'z")) end) it('works with file/uppercase marks', function() curbufmeths.set_lines(-1, -1, true, {'a', 'bit of', 'text'}) - eq(true, curbufmeths.set_mark('Z', 3, 1, {})) - eq({3, 1}, curbufmeths.get_mark('Z')) + eq(true, curbufmeths.set_mark('Z', 3, 2, {})) + eq({3, 2}, curbufmeths.get_mark('Z')) + eq({curbuf().id, 3, 3, 0}, funcs.getpos("'Z")) end) it('fails when invalid marks names are used', function() eq(false, pcall(curbufmeths.set_mark, '!', 1, 0, {})) |