Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Conversation

@firstmover
Copy link
Contributor

This commit replaces Neovim's built-in function charcol with functions that is available >= 0.5.
charcoal Neovim built-in function is introduced in Neovim 0.7 (see neovim/neovim@6ab7168). The get_window_context function in hop.nvim will raise function not found error when the Neovim version is below 0.7.
This commit partially reverts the 6ed29f1 commit without breaking it.

@aznhe21
Copy link
Contributor

aznhe21 commented Nov 8, 2022

No, this will not pass the test cases in #315.

I'v tried charidx and others, but it seems impossible to simulate charcol before neovim 0.7. So I think it's better to use charcol in neovim 0.7+, and allow bugs and use the original code in older neovim.

local cur_col
if vim.fn.exists('*charcol') == 1 then
  cur_col = vim.fn.charcol('.')
else
  cur_col = vim.fn.strwidth(vim.api.nvim_get_current_line():sub(1, vim.fn.col('.')))
end

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants