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: wrong labe positioning on double-width chars #90

Closed
3 tasks done
atusy opened this issue Jun 28, 2023 · 5 comments · Fixed by #86
Closed
3 tasks done

bug: wrong labe positioning on double-width chars #90

atusy opened this issue Jun 28, 2023 · 5 comments · Fixed by #86
Labels
bug Something isn't working

Comments

@atusy
Copy link
Contributor

atusy commented Jun 28, 2023

Did you check docs and existing issues?

  • I have read all the flash.nvim docs
  • I have searched the existing issues of flash.nvim
  • I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

NVIM v0.10.0-dev-585+g2e055e49a

Operating system/version

Manjaro Linux

Describe the bug

When patteren has double-width chars, label is placed on a next character of the matches.

Below is an example to search from あxあxあxあxあxあx.
You can see labels are placed on x

image

Steps To Reproduce

  1. Prepare buffer
あxあxあxあxあxあx
あxあxあxあxあxあx
  1. Do flash
require("flash").jump({pattern = "あ", search = { wrap = false }})

Expected Behavior

labels should be placed on

Repro

-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath, })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  "folke/tokyonight.nvim",
  { "folke/flash.nvim", opts = {} },
  -- add any other plugins here
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here
@atusy atusy added the bug Something isn't working label Jun 28, 2023
@folke
Copy link
Owner

folke commented Jun 28, 2023

By default labels are placed after the matches, so this works as it should.

There's multiple options to put the labels somewhere else. Please refer to the config section of the readme

@folke folke closed this as not planned Won't fix, can't repro, duplicate, stale Jun 28, 2023
@atusy
Copy link
Contributor Author

atusy commented Jun 28, 2023

Sorry, my example was incomplete.

I noticed this behavior when trying f-motion.

Could you compare these two with a buffer containing あxあxあxあxあxあx?

-- label on x works
require("flash").jump({pattern = "x", search = { wrap = false }, label = { after = {0, 0}, before = false }})

-- trying to label あ
require("flash").jump({pattern = "", search = { wrap = false }, label = { after = {0, 0}, before = false }})

@atusy
Copy link
Contributor Author

atusy commented Jun 28, 2023

I think label = { after = false, before = {0, 0} } is the safer option at here:

F = { search = { forward = false }, label = { after = { 0, 0 }, before = false } },

@folke folke reopened this Jun 29, 2023
@folke folke closed this as completed in 0193d52 Jun 29, 2023
@folke
Copy link
Owner

folke commented Jun 29, 2023

Should be fixed now!

@atusy
Copy link
Contributor Author

atusy commented Jul 4, 2023

Thanks, perfect!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants