kakoune: escape showWhitespace separators
We were passing the separators for the `show-whitespaces` highlighter verbatim. This was problematic in case one wanted to use, spaces, quotes or `%` as separators since the resulting kakoune configuration would be invalid. According to kakoune's docs, the separator has to be one character long, so we can use a simple rule for escaping them. It is possible that people has been working this around by passing, e.g. `"' '"` as separator in order to get a space (i.e., escaped explicitly by the user), so we just let longer strings be used verbatim. PR #1357
This commit is contained in:
parent
861690ff29
commit
d1f4d1514d
4 changed files with 47 additions and 8 deletions
|
|
@ -506,12 +506,22 @@ let
|
|||
];
|
||||
|
||||
showWhitespaceOptions = with cfg.config.showWhitespace;
|
||||
concatStrings [
|
||||
(optionalString (tab != null) " -tab ${tab}")
|
||||
(optionalString (tabStop != null) " -tabpad ${tabStop}")
|
||||
(optionalString (space != null) " -spc ${space}")
|
||||
(optionalString (nonBreakingSpace != null) " -nbsp ${nonBreakingSpace}")
|
||||
(optionalString (lineFeed != null) " -lf ${lineFeed}")
|
||||
let
|
||||
quoteSep = sep:
|
||||
if sep == "'" then
|
||||
''"'"''
|
||||
else if lib.strings.stringLength sep == 1 then
|
||||
"'${sep}'"
|
||||
else
|
||||
sep; # backwards compat, in case sep == "' '", etc.
|
||||
|
||||
in concatStrings [
|
||||
(optionalString (tab != null) " -tab ${quoteSep tab}")
|
||||
(optionalString (tabStop != null) " -tabpad ${quoteSep tabStop}")
|
||||
(optionalString (space != null) " -spc ${quoteSep space}")
|
||||
(optionalString (nonBreakingSpace != null)
|
||||
" -nbsp ${quoteSep nonBreakingSpace}")
|
||||
(optionalString (lineFeed != null) " -lf ${quoteSep lineFeed}")
|
||||
];
|
||||
|
||||
uiOptions = with cfg.config.ui;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue