kakoune
kakoune copied to clipboard
Don't escape markup strings in modeline expansions
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
After
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.
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:
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.