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 end_col: out of range #81

Closed
linrongbin16 opened this issue Jul 25, 2024 · 0 comments · Fixed by #82
Closed

Bug: Invalid end_col: out of range #81

linrongbin16 opened this issue Jul 25, 2024 · 0 comments · Fixed by #82

Comments

@linrongbin16
Copy link

linrongbin16 commented Jul 25, 2024

Describe the bug

When using <cmd>HopLineAC<cr> or <cmd>HopLineBC<cr> to jump to below/above lines, there's an error:

image

To Reproduce

Install hop.nvim with lazy.nvim:

  {
    "smoka7/hop.nvim",
    version = "*",
    config = function() 
      require("hop").setup()
    end,
  },

I found in below lua file, it can always re-produce this issue.

Here's the file link: https://github.com/linrongbin16/fzfx.nvim/blob/2f7425cf7fdb94814eb98295f3fb7851daace68d/spec/lib/switches_spec.lua?plain=1#L13

local cwd = vim.fn.getcwd()

describe("lib.switches", function()
  local assert_eq = assert.is_equal
  local assert_true = assert.is_true
  local assert_false = assert.is_false

  before_each(function()
    vim.api.nvim_command("cd " .. cwd)
  end)

  local switches = require("fzfx.lib.switches")
  describe("[fzfx_disable_buffer_previewer]", function()
    it("disabled", function()
      vim.g.fzfx_disable_buffer_previewer = 1
      assert_true(switches.buffer_previewer_disabled())
      vim.g.fzfx_disable_buffer_previewer = true
      assert_true(switches.buffer_previewer_disabled())
      vim.g.fzfx_disable_buffer_previewer = "true"
      assert_false(switches.buffer_previewer_disabled())
      vim.g.fzfx_disable_buffer_previewer = nil
      assert_false(switches.buffer_previewer_disabled())
    end)
    it("enabled", function()
      vim.g.fzfx_disable_buffer_previewer = 0
      assert_false(switches.buffer_previewer_disabled())
      vim.g.fzfx_disable_buffer_previewer = false
      assert_false(switches.buffer_previewer_disabled())
      vim.g.fzfx_disable_buffer_previewer = "false"
      assert_false(switches.buffer_previewer_disabled())
      vim.g.fzfx_disable_buffer_previewer = nil
      assert_false(switches.buffer_previewer_disabled())
    end)
  end)
end)

The re-produce steps are:

  1. Place the cursor to line-13, column-47 (the function()).
  2. Press <S-V> to enter visual mode (and current line is selected).
  3. Press G to go to bottom line (and from the start line to the bottom line are all selected).
  4. Press <Leader>k (I mapped this key to <cmd>HopLineBC<cr>) to jump to above lines.

Expected behavior

Don't throw exception, and jump correctly.

Screenshots

See above.

version (please complete the following information):

  • Nvim version: NVIM v0.10.1, Build type: Release.
  • hop.nvim version: v2.7.0.

Additional context

N/A.

@linrongbin16 linrongbin16 changed the title Bug: Bug: Invalid end_col: out of range Jul 25, 2024
@smoka7 smoka7 closed this as completed in #82 Aug 8, 2024
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.

1 participant