kakoune icon indicating copy to clipboard operation
kakoune copied to clipboard

Don't escape markup strings in modeline expansions

Open raiguard opened this issue 2 years ago • 2 comments

Fixes #4507

The documentation for modelinefmt states that expansions are processed, then markup strings are applied. This brings the actual behavior in line with the documentation.

Before

image

After

image

raiguard avatar Jan 17 '22 20:01 raiguard

I think the reason we escape potential '{' is that there is not guarantee that what you expand in modelinefmt is markup aware, and there is no easy was to escape it yourself. The buffer name for example could contain a '{' and with this change applied it will be treated as a face description.

mawww avatar Feb 15 '22 10:02 mawww

For what it's worth, I have been using this in a custom branch for nine months, and have had no issues with it. Sure, if you put braces in a filename, it'll be treated as markup, but braces in a filename is extraordinarily rare. At least, I've never run into it in my workflow.

Without this change, getting my modeline to look how it does requires significantly more shell logic, which executes on every keystroke and murders performance.

I'm not sure what a proper solution for this issue would look like. I made my filename {Error}foo just for fun: image

raiguard avatar Sep 15 '22 05:09 raiguard

I have drastically simplified my modeline, so I no longer need this PR. Since it has unresolved issues, I'll go ahead and close it.

raiguard avatar Nov 06 '22 19:11 raiguard