nvim-metals icon indicating copy to clipboard operation
nvim-metals copied to clipboard

`g:metals_status` breaks statusline because of unescaped characters

Open caenrique opened this issue 1 year ago • 2 comments

Describe the bug

g:metals_status sometimes contains unescaped % symbols that breaks the status line evaluation (vim.api.nvim_eval_statusline) because those are special characters.

Expected behavior

% and any other posible special characters according to the statusline definition should be escaped

Operating system

macOS

Version of Metals

v0.11.8

Commit of nvim-metals

1284bbf8d79fe010909e65abdd849f047ff51914

caenrique avatar Oct 04 '22 20:10 caenrique

Hey @caenrique thanks for the report! I never noticed or thought of this before. Do you have any examples of when this was the case for you? An example of the message specifically?

I guess we could scan the string on the nvim-metals side and replace any occurrence of % with %% and that should do the trick.

ckipp01 avatar Oct 05 '22 08:10 ckipp01

Yes! one example is: Compiling subscriptions 5s (0%).

I'm using feline.nvim for the statusline and I also created an issue there before I found the exact problem.

Replacing % with %% is exactly what I'm doing now to fix it, as suggested in the issue:

string.gsub(vim.g['metals_status'], '[%%]', '%%%1')

caenrique avatar Oct 05 '22 08:10 caenrique