folke / flash.nvim

Navigate your code with search labels, enhanced character motions and Treesitter integration
Apache License 2.0
2.55k stars 34 forks source link

bug: broken macros when using 'f' character jump #366

Closed skrobul closed 1 month ago

skrobul commented 2 months ago

Did you check docs and existing issues?

Neovim version (nvim -v)

v0.11.0-nightly+4e8efe0

Operating system/version

Linux Nixos 24.05

Describe the bug

I am getting weird behaviour while trying to record a simple macro, similar to https://github.com/folke/flash.nvim/issues/143, but not quite the same because I don't use dot repeats here.

Steps To Reproduce

  1. nvim -u repro.lua
  2. Paste the input text which we can operate on: Macro that doesn't work:
email_recipient = salt['pillar.get']('keepalived:email:recipient', 'example@example.com')
email_sender = salt['pillar.get']('keepalived:email:sender', 'other@example.com')
email_smtp = salt['pillar.get']('keepalived:email:smtp', 'smtp1.example.com')

Macro line:
f=hdf,i:f)x
  1. Place the cursor below the macro, and yank the line into 'q register: "qy$
  2. Try to execute macro @q on any of the lines

Expected Behavior

Executing the macro with flash.nvim on a email_smtp line results in following output:

email_smtp: salt['pillar.get']('keepalived:email:smtp', 'smtp1.example.com'

In vanilla neovim, running the same macro produces correct line:

email_smtp: 'smtp1.example.com'

Interestingly, if you record another macro using Ctrl+C to exit insert mode instead of Escape, the macro works. It seems to populate the macro register with some odd characters though:

㵦ﶀ栵晤耬㗽㩩̃⥦ﶀ砵 github interprets those as some Chinese unicode, but this is how they look in vim: image

Repro

vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()

require("lazy.minit").repro({
  spec = {
    { "folke/flash.nvim", opts = {} },
  },
})
github-actions[bot] commented 1 month ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] commented 1 month ago

This issue was closed because it has been stalled for 7 days with no activity.