-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: Cyrillic words tear apart #1
Comments
Glad you found useful and thanks for the bug report. I looks like lua/neovim treats cyrillic characters rent to latin ones. vim.split('привет', '')
{ "<d0>", "<bf>", "<d1>", "<80>", "<d0>", "<b8>", "<d0>", "<b2>", "<d0>", "<b5>", "<d1>", "<82>" } I will try to look into this over the weekend. If you know of a solution do let me know. |
I think you can try this approach for handling non english (non one byte chars) text: -- NOTE: example work only when cursor on last char of selection and only charwise visual mode.
-- Edge cases are also not taken into account.
vim.keymap.set('x', '<c-b>', function()
-- get visual selection range
-- for case when curson on start char it need reorder (sr = er, er = sr e.t.c)
local er, ec = unpack(vim.fn.getpos('.'), 2, 3)
local sr, sc = unpack(vim.fn.getpos('v'), 2, 3)
-- save real text in 'v' register (no independent of count byte in char)
vim.cmd.normal('"vy')
local text = vim.split(vim.fn.getreg('v'), '\n', { plain = true })
-- clear register
vim.fn.setreg('v', '')
-- check two byte on end of range
local last_row = vim.fn.getline(er)
local char = last_row:sub(ec, ec + 1)
local last_col
if #char ~= 0 then
if #char == vim.fn.strdisplaywidth(char) then
-- if display len equals with byte len, use normal end col
last_col = ec
else
print('else')
-- if display len not equals with byte len, use delta
last_col = #char - vim.fn.strdisplaywidth(char) + ec
end
else
last_col = 0
end
local prefix = '**'
local postfix = '**'
text[1] = prefix .. text[1]
text[#text] = text[#text] .. postfix
vim.api.nvim_buf_set_text(0, sr - 1, sc - 1, er - 1, last_col, text)
end) markdowny.movHope this will help |
👍 for fixing this. |
ful1e5
added a commit
to ful1e5/markdowny.nvim
that referenced
this issue
Feb 14, 2023
I (@ful1e5) have fully rewritten the plugin and incorporated the requested newline and singleline surroundings in code block described in issue antonk52#7, while also taking into consideration issue antonk52#1.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey there.
Great plugin! Really needed it for some time, but didn't have time to make it myself. Imma use it now.
Repro of the bug:
Type a word:
Invoke any command (italics/bold/link)
Here's what you get:
The text was updated successfully, but these errors were encountered: