From ee7579154745902fbea6367bcf306b772d14d2d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikl=C3=B3s=20Bal=C3=A1zs?= Date: Sat, 16 Aug 2025 16:48:42 +0200 Subject: [PATCH 1/3] Using the character index instead of the byte index To replace the text properly, the character index will be needed, which in case of multibyte Unicode characters will differ from the byte index. --- lua/obsidian/completion/refs.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lua/obsidian/completion/refs.lua b/lua/obsidian/completion/refs.lua index 70e009c1..5eb29ea6 100644 --- a/lua/obsidian/completion/refs.lua +++ b/lua/obsidian/completion/refs.lua @@ -41,14 +41,14 @@ M.can_complete = function(request) if vim.startswith(input, "[[") then local suffix = string.sub(request.context.cursor_after_line, 1, 2) - local cursor_col = request.context.cursor.col + local cursor_char = request.context.cursor.character local insert_end_offset = suffix == "]]" and 1 or -1 - return true, search, cursor_col - 1 - #input, cursor_col + insert_end_offset, M.RefType.Wiki + return true, search, cursor_char - #input, cursor_char + 1 + insert_end_offset, M.RefType.Wiki elseif vim.startswith(input, "[") then local suffix = string.sub(request.context.cursor_after_line, 1, 1) - local cursor_col = request.context.cursor.col + local cursor_char = request.context.cursor.character local insert_end_offset = suffix == "]" and 0 or -1 - return true, search, cursor_col - 1 - #input, cursor_col + insert_end_offset, M.RefType.Markdown + return true, search, cursor_char - #input, cursor_char + 1 + insert_end_offset, M.RefType.Markdown else return false end From 3f166333f346ec4c3ef9b64378e6f5684929df24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikl=C3=B3s=20Bal=C3=A1zs?= Date: Sat, 16 Aug 2025 17:12:03 +0200 Subject: [PATCH 2/3] Fixing the build The Neovim nightly file name changed. --- .github/workflows/docs.yml | 2 +- .github/workflows/main.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 0be5a8b0..e1313d5b 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -16,7 +16,7 @@ env: runtime: ~/.local/share/nvim/site/pack/vendor/start minidoc-git: https://github.com/echasnovski/mini.doc minidoc-path: ~/.local/share/nvim/site/pack/vendor/start/mini.doc - nvim_url: https://github.com/neovim/neovim/releases/download/nightly/nvim-linux64.tar.gz + nvim_url: https://github.com/neovim/neovim/releases/download/nightly/nvim-linux-x86_64.tar.gz jobs: docs: diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 11692f71..0cfa36eb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -57,7 +57,7 @@ jobs: include: - os: ubuntu-latest - nvim_url: https://github.com/neovim/neovim/releases/download/nightly/nvim-linux64.tar.gz + nvim_url: https://github.com/neovim/neovim/releases/download/nightly/nvim-linux-x86_64.tar.gz packages: luarocks ripgrep manager: sudo apt-get From 3d6133a1bfb4cb00272d8df635570807e9a65fbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikl=C3=B3s=20Bal=C3=A1zs?= Date: Sat, 16 Aug 2025 17:23:27 +0200 Subject: [PATCH 3/3] Updated changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b585ed0e..fa65c9cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed an edge case with collecting backlinks. - Fixed typo in `ObsidianPasteImg`'s command description - Fixed the case when `opts.attachments` is `nil`. +- Fixed reference creation in case the line has Unicode characters. ## [v3.9.0](https://github.com/epwalsh/obsidian.nvim/releases/tag/v3.9.0) - 2024-07-11