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

Error when trying to navigate to line from empty line #335

Open
chaudry-786 opened this issue Oct 20, 2022 · 21 comments
Open

Error when trying to navigate to line from empty line #335

chaudry-786 opened this issue Oct 20, 2022 · 21 comments

Comments

@chaudry-786
Copy link

Hi,
If I try to navigate to another line "HopLineAC" or "HopLineBC" from an empty line I get following error.

E5108: Error executing lua /Users/sabah/.vim/plugged/hop.nvim/lua/hop/init.lua:130: col value outside range
stack traceback:
        [C]: in function 'nvim_buf_set_extmark'
        /Users/sabah/.vim/plugged/hop.nvim/lua/hop/init.lua:130: in function 'set_unmatched_lines'
        /Users/sabah/.vim/plugged/hop.nvim/lua/hop/init.lua:140: in function 'apply_dimming'
        /Users/sabah/.vim/plugged/hop.nvim/lua/hop/init.lua:352: in function 'hint_with_callback'
        /Users/sabah/.vim/plugged/hop.nvim/lua/hop/init.lua:304: in function 'hint_with'
        /Users/sabah/.vim/plugged/hop.nvim/lua/hop/init.lua:544: in function 'hint_lines'
        [string ":lua"]:1: in main chunk
@samjwill
Copy link

samjwill commented Oct 23, 2022

This doesn't happen for me on Ubuntu 22.04 with Neovim v0.8.0-1210-gd367ed9b2 (Release) and LuaJIT 2.1.0-beta3 . Is there something unique about your setup or file that you're editing that might suggest the cause of the issue?

image

@cheeze2000
Copy link

:HopWordAC and :HopWordBC also have the same error when used on an empty line.

NVIM v0.8.0
Build type: Release
LuaJIT 2.1.0-beta3

@chaudry-786
Copy link
Author

NVIM v0.7.2
Build type: Release
LuaJIT 2.1.0-beta3

@mystilleef
Copy link

@sabah1994, are you using the hop.hint_lines API?

@chaudry-786
Copy link
Author

@mystilleef I dont't think so.

This is my config https://github.com/sabah1994/dotfiles/blob/d758306f2b02436ad5b48d6f8957e34b5e9a6405/nvim/lua/plug-config/hop.lua#L3

@chaudry-786
Copy link
Author

@samjwill @mystilleef any update on this please?

@mystilleef
Copy link

@samjwill @mystilleef any update on this please?

Unfortunately, I'm having the same issue.

@klingberg
Copy link

I have the same issue with HopChar2AC and HopChar2BC. It seems like the error occurs when I jump from an empty line and Hop suggests multiple destinations. When there is only one matching destination no error occurs.

@hadronized
Copy link
Owner

I’m having a look at that tomorrow. That bug has been crawling around in several part of the API, and a refactor of the window position / jump is probably required as more and more features were added in the past months.

@juanchinojo
Copy link

Currently having the same issue, anyone been able to find a workaround?

NVIM v0.8.0
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by [email protected]

@BartSte
Copy link

BartSte commented Nov 2, 2022

Currently having the same issue, anyone been able to find a workaround?

NVIM v0.8.0 Build type: Release LuaJIT 2.1.0-beta3 Compiled by [email protected]

As a workaround, when the cursor is on a blank line, I let it jump to the next non-blank line, for example:

local function hop_w()
    local opts = { direction = hint.HintDirection.AFTER_CURSOR }
    vim.cmd('.g/^$/normal )')
    hop.hint_words(opts)
end

Not a nice way, and it won't work all the time, but it is enough for now...

@chaudry-786
Copy link
Author

@phaazon any update on this?

@jesHrz
Copy link

jesHrz commented Nov 7, 2022

Same issue on hint_char1 and hint_word

NVIM v0.8.0
Build type: Release
LuaJIT 2.1.0-beta3

@liketurbo
Copy link

liketurbo commented Nov 9, 2022

Currently having the same issue, anyone been able to find a workaround?
NVIM v0.8.0 Build type: Release LuaJIT 2.1.0-beta3 Compiled by [email protected]

As a workaround, when the cursor is on a blank line, I let it jump to the next non-blank line, for example:

local function hop_w()
    local opts = { direction = hint.HintDirection.AFTER_CURSOR }
    vim.cmd('.g/^$/normal )')
    hop.hint_words(opts)
end

Not a nice way, and it won't work all the time, but it is enough for now...

Still will break though if you on the last line and it is empty or file consists of an empty lines 😞
But for now it's the only solution 👈️

@chaudry-786
Copy link
Author

any progress on this?

@AlkTheOrg
Copy link

AlkTheOrg commented Dec 28, 2022

This doesn't happen for me on Ubuntu 22.04 with Neovim v0.8.0-1210-gd367ed9b2 (Release) and LuaJIT 2.1.0-beta3 . Is there something unique about your setup or file that you're editing that might suggest the cause of the issue?

Not sure about Ubuntu, but having the same problem both in Mac Ventura and W10.

@BartSte
Copy link

BartSte commented Dec 30, 2022

Currently having the same issue, anyone been able to find a workaround?
NVIM v0.8.0 Build type: Release LuaJIT 2.1.0-beta3 Compiled by [email protected]

As a workaround, when the cursor is on a blank line, I let it jump to the next non-blank line, for example:

local function hop_w()
    local opts = { direction = hint.HintDirection.AFTER_CURSOR }
    vim.cmd('.g/^$/normal )')
    hop.hint_words(opts)
end

Not a nice way, and it won't work all the time, but it is enough for now...

Still will break though if you on the last line and it is empty or file consists of an empty lines disappointed But for now it's the only solution point_left

A better work around is to use the following branch instead of the workaround above: https://github.com/aznhe21/hop.nvim/tree/fix-some-bugs

Hopefully it gets merged soon...

@spire-carlos
Copy link

Plug 'aznhe21/hop.nvim', { 'branch': 'fix-some-bugs'}

@BartSte
Copy link

BartSte commented Apr 1, 2023

Will this fix ever get merged?

@FelipeLema
Copy link
Contributor

Will this fix ever get merged?

@BartSte can't say for sure, but you might try directly using the branch that fixes it in your config

@BartSte
Copy link

BartSte commented Apr 3, 2023

Currently having the same issue, anyone been able to find a workaround?
NVIM v0.8.0 Build type: Release LuaJIT 2.1.0-beta3 Compiled by [email protected]

As a workaround, when the cursor is on a blank line, I let it jump to the next non-blank line, for example:

local function hop_w()
    local opts = { direction = hint.HintDirection.AFTER_CURSOR }
    vim.cmd('.g/^$/normal )')
    hop.hint_words(opts)
end

Not a nice way, and it won't work all the time, but it is enough for now...

Still will break though if you on the last line and it is empty or file consists of an empty lines disappointed But for now it's the only solution point_left

A better work around is to use the following branch instead of the workaround above: https://github.com/aznhe21/hop.nvim/tree/fix-some-bugs

Hopefully it gets merged soon...

Yes I know ;) @FelipeLema

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

No branches or pull requests