diff --git a/rc/git-tools.kak b/rc/git-tools.kak index ddb1d490..602b73c4 100644 --- a/rc/git-tools.kak +++ b/rc/git-tools.kak @@ -63,9 +63,10 @@ def -shell-params \ if (line == "") { return; } text=substr(sha,1,8) " " dates[sha] " " authors[sha] gsub(":", "\\:", text) - flag=line "|black|" text + gsub(",", "\\,", text) + flag=line ",black," text for ( i=1; i < count; i++ ) { - flag=flag ":" line+i "|black|" text + flag=flag ":" line+i ",black," text } cmd = "kak -p " ENVIRON["kak_session"] print "set -add buffer=" ENVIRON["kak_bufname"] " git_blame_flags %{" flag "}" | cmd @@ -90,7 +91,7 @@ def -shell-params \ git diff -U0 $kak_buffile | awk -e ' BEGIN { line=0 - flags="0|red|." + flags="0,red,." } /^---.*/ {} /^@@ -[0-9]+(,[0-9]+)? \+[0-9]+(,[0-9]+)? @@.*/ { @@ -101,10 +102,10 @@ def -shell-params \ } } /^\+/ { - flags=flags ":" line "|green|+" + flags=flags ":" line ",green,+" line++ } - /^\-/ { flags=flags ":" line "|red|-" } + /^\-/ { flags=flags ":" line ",red,-" } END { print "set buffer git_diff_flags ", flags } ' } diff --git a/src/option_types.hh b/src/option_types.hh index e68ddc30..7b0ebbf1 100644 --- a/src/option_types.hh +++ b/src/option_types.hh @@ -99,7 +99,7 @@ bool option_add(std::unordered_set& opt, const std::unordered_set& set) return not set.empty(); } -constexpr Codepoint tuple_separator = '|'; +constexpr Codepoint tuple_separator = ','; template struct TupleOptionDetail @@ -175,9 +175,9 @@ bool option_add(T&, const T&) template inline void option_from_string(const String& str, LineAndColumn& opt) { - auto vals = split(str, '|'); + auto vals = split(str, tuple_separator); if (vals.size() != 2) - throw runtime_error("expected |"); + throw runtime_error("expected "_str + tuple_separator + ""); opt.line = str_to_int(vals[0]); opt.column = str_to_int(vals[1]); } @@ -185,7 +185,7 @@ inline void option_from_string(const String& str, LineAndColumn inline String option_to_string(const LineAndColumn& opt) { - return to_string(opt.line) + '|' + to_string(opt.column); + return to_string(opt.line) + tuple_separator + to_string(opt.column); } enum YesNoAsk