ibhagwan / fzf-lua

Improved fzf.vim written in lua
MIT License
2.37k stars 151 forks source link

fix: escape "%" in gsub target #1445

Closed phanen closed 2 months ago

phanen commented 2 months ago

Fix https://github.com/ibhagwan/fzf-lua/issues/1443.

ibhagwan commented 2 months ago

If doing this change we need to make sure we’re covering all lua escape chars, we can use utils.lua_regex_escape

ibhagwan commented 2 months ago

Just realized this happens due to the replacement string escaping and not the input string, the % is probably all that’s needed.

ibhagwan commented 2 months ago

I knew I encountered this before :) https://github.com/ibhagwan/fzf-lua/blob/985e1002b5dc70f8196ea0605bbfffc8c8407e31/lua/fzf-lua/core.lua#L1254-L1255

Ty @phanen!

ibhagwan commented 2 months ago

Looking at the code I just posted shouldn’t the replacement string gsub be 4x%?

ibhagwan commented 2 months ago

Fixed it with a force push https://github.com/ibhagwan/fzf-lua/commit/f513524561060f2b9e3bd6d36ff046bfa03ca114.

nenahp commented 2 months ago

Should be 4%, I got into the second trap.