e1fd2351e0
Commit 53d9b9b67
(Escaping tweak in git.kak, 2024-02-06) broke
blame-jump when the commit subject contains a single quote.
(Also on unbalanced "{" which is a rare edge case but we already have
it in our Git history.)
git.kak assumes that filenames don't contain ' or unbalanced {,
but we can't really make that assumption about people's names or
commit subjects.
Unfortunately the escaping here is very messy. We need to pass
arbitrary text to callbacks; maybe we should have closures that can
capture private temporary registers.
11 lines
1.1 KiB
Plaintext
11 lines
1.1 KiB
Plaintext
ui_out -ignore 7
|
|
ui_out -ignore 4
|
|
|
|
ui_out -ignore 3
|
|
subject=$(cat <<'EOF'
|
|
2017-07-14 A U Thor "Don't break on single quotes or unbalanced {"
|
|
EOF
|
|
)
|
|
json_quoted_subject=\"$(printf '%s' "$subject" | sed 's/"/\\"/g')\"
|
|
ui_out -within-next 3 '{ "jsonrpc": "2.0", "method": "draw_status", "params": [[{ "face": { "fg": "black", "bg": "yellow", "underline": "default", "attributes": [] }, "contents": '"$json_quoted_subject"' }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "*git* 13:2 " }, { "face": { "fg": "black", "bg": "yellow", "underline": "default", "attributes": [] }, "contents": "[scratch]" }, { "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": " " }, { "face": { "fg": "blue", "bg": "default", "underline": "default", "attributes": [] }, "contents": "1 sel" }, { "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": " - client0@[kak-tests]" }], { "fg": "cyan", "bg": "default", "underline": "default", "attributes": [] }] }'
|