mirror of
https://github.com/neovim/neovim.git
synced 2024-12-23 20:55:18 -07:00
ops: fix i<c-r> with multi-byte text (#6524)
This commit is contained in:
parent
58d2ce9bdb
commit
12fc1defd6
@ -302,13 +302,13 @@ static void add_num_buff(buffheader_T *buf, long n)
|
||||
*/
|
||||
static void add_char_buff(buffheader_T *buf, int c)
|
||||
{
|
||||
char bytes[MB_MAXBYTES + 1];
|
||||
uint8_t bytes[MB_MAXBYTES + 1];
|
||||
|
||||
int len;
|
||||
if (IS_SPECIAL(c)) {
|
||||
len = 1;
|
||||
} else {
|
||||
len = (*mb_char2bytes)(c, (char_u *)bytes);
|
||||
len = mb_char2bytes(c, bytes);
|
||||
}
|
||||
|
||||
for (int i = 0; i < len; i++) {
|
||||
|
19
test/functional/insert/ctrl_r_spec.lua
Normal file
19
test/functional/insert/ctrl_r_spec.lua
Normal file
@ -0,0 +1,19 @@
|
||||
local helpers = require('test.functional.helpers')(after_each)
|
||||
local clear, feed = helpers.clear, helpers.feed
|
||||
local expect, command = helpers.expect, helpers.command
|
||||
|
||||
describe('insert-mode Ctrl-R', function()
|
||||
before_each(clear)
|
||||
|
||||
it('works', function()
|
||||
command("let @@ = 'test'")
|
||||
feed('i<C-r>"')
|
||||
expect('test')
|
||||
end)
|
||||
|
||||
it('works with multi-byte text', function()
|
||||
command("let @@ = 'påskägg'")
|
||||
feed('i<C-r>"')
|
||||
expect('påskägg')
|
||||
end)
|
||||
end)
|
Loading…
Reference in New Issue
Block a user