nixos/fcitx5: handle multi-line string and escape in quickPhrase

This commit is contained in:
linsui 2024-12-22 17:10:51 +08:00
parent fedf16bc04
commit 97728d9f5a

View file

@ -117,7 +117,9 @@ in
i18n.inputMethod.fcitx5.addons =
lib.optionals (cfg.quickPhrase != { }) [
(pkgs.writeTextDir "share/fcitx5/data/QuickPhrase.mb" (
lib.concatStringsSep "\n" (lib.mapAttrsToList (name: value: "${name} ${value}") cfg.quickPhrase)
lib.mapAttrsToList (
name: value: "${name} ${builtins.replaceStrings [ "\\" "\n" ] [ "\\\\" "\\n" ] value}"
) cfg.quickPhrase
))
]
++ lib.optionals (cfg.quickPhraseFiles != { }) [