Skip to content
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] Invalid 'col': out of range #361

Closed
linrongbin16 opened this issue May 4, 2023 · 8 comments · May be fixed by #363
Closed

[BUG] Invalid 'col': out of range #361

linrongbin16 opened this issue May 4, 2023 · 8 comments · May be fixed by #363

Comments

@linrongbin16
Copy link

linrongbin16 commented May 4, 2023

Hi, I'm using HopChar1AC to jump forward, but there's an exception Invalid 'col': out of range:

image

It's happening on a specific file, not on every file.

@nikolasetiawan
Copy link

Experiencing the same issue. For me, this happens when initiating hint_char1 from an empty line. It shows the following error:

Invalid 'col': out of range

@BartSte
Copy link

BartSte commented May 6, 2023

Experiencing the same issue. For me, this happens when initiating hint_char1 from an empty line. It shows the following error:

Invalid 'col': out of range

Possible duplicate from #335. I had the same issue. Ah PR was made by someone but it is not merged, unfortunately.

@prss-ad
Copy link

prss-ad commented May 13, 2023

HI,
I'm having the same problem . From what i gathered, it happens when on an empty line as reported. But i can also say it only happens when hint.direction is set and current_line_only is false.

-- this works flawlessly even with multiwindows
vim.keymap.set({ 'n', 'x' }, 'j', function() require('hop').hint_char1()
end)
-- but this does not (same for F,t,T) , --- Invalid col : out of range
vim.keymap.set({ 'n', 'x' }, 'f', function()
require('hop').hint_char1({
direction = require('hop.hint').HintDirection.AFTER_CURSOR,
current_line_only = false
})
end)

Hope this helps a bit.
Thanks for this plugin .
It's great.

@theofabilous
Copy link

There's a pull request (#358) that fixes this issue, it's been open for a while. Personally I added:

  if #vim.api.nvim_get_current_line() == 0 then
    cursor_pos[2] = cursor_pos[2] - 1
  end

after line 92 in init.lua and it fixed the problem

@prss-ad
Copy link

prss-ad commented May 17, 2023

Thanks theofabilous ! That works, missed the pull request...

@yingmanwumen
Copy link

hello, there's another PR #363 fix this bug, and it works on my machine

@rudfol
Copy link

rudfol commented Jun 21, 2023

There's a pull request (#358) that fixes this issue, it's been open for a while. Personally I added:

  if #vim.api.nvim_get_current_line() == 0 then
    cursor_pos[2] = cursor_pos[2] - 1
  end

after line 92 in init.lua and it fixed the problem

Absolutely greate mate, thank you!

@linrongbin16
Copy link
Author

I moved to a new fork (see #369): https://github.com/smoka7/hop.nvim, it works great to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants