Use ',' instead of '|' as tuple option fields separators
This commit is contained in:
parent
17d591b61c
commit
008ba2cbab
|
@ -63,9 +63,10 @@ def -shell-params \
|
||||||
if (line == "") { return; }
|
if (line == "") { return; }
|
||||||
text=substr(sha,1,8) " " dates[sha] " " authors[sha]
|
text=substr(sha,1,8) " " dates[sha] " " authors[sha]
|
||||||
gsub(":", "\\:", text)
|
gsub(":", "\\:", text)
|
||||||
flag=line "|black|" text
|
gsub(",", "\\,", text)
|
||||||
|
flag=line ",black," text
|
||||||
for ( i=1; i < count; i++ ) {
|
for ( i=1; i < count; i++ ) {
|
||||||
flag=flag ":" line+i "|black|" text
|
flag=flag ":" line+i ",black," text
|
||||||
}
|
}
|
||||||
cmd = "kak -p " ENVIRON["kak_session"]
|
cmd = "kak -p " ENVIRON["kak_session"]
|
||||||
print "set -add buffer=" ENVIRON["kak_bufname"] " git_blame_flags %{" flag "}" | cmd
|
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 '
|
git diff -U0 $kak_buffile | awk -e '
|
||||||
BEGIN {
|
BEGIN {
|
||||||
line=0
|
line=0
|
||||||
flags="0|red|."
|
flags="0,red,."
|
||||||
}
|
}
|
||||||
/^---.*/ {}
|
/^---.*/ {}
|
||||||
/^@@ -[0-9]+(,[0-9]+)? \+[0-9]+(,[0-9]+)? @@.*/ {
|
/^@@ -[0-9]+(,[0-9]+)? \+[0-9]+(,[0-9]+)? @@.*/ {
|
||||||
|
@ -101,10 +102,10 @@ def -shell-params \
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/^\+/ {
|
/^\+/ {
|
||||||
flags=flags ":" line "|green|+"
|
flags=flags ":" line ",green,+"
|
||||||
line++
|
line++
|
||||||
}
|
}
|
||||||
/^\-/ { flags=flags ":" line "|red|-" }
|
/^\-/ { flags=flags ":" line ",red,-" }
|
||||||
END { print "set buffer git_diff_flags ", flags }
|
END { print "set buffer git_diff_flags ", flags }
|
||||||
'
|
'
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,7 +99,7 @@ bool option_add(std::unordered_set<T>& opt, const std::unordered_set<T>& set)
|
||||||
return not set.empty();
|
return not set.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr Codepoint tuple_separator = '|';
|
constexpr Codepoint tuple_separator = ',';
|
||||||
|
|
||||||
template<size_t I, typename... Types>
|
template<size_t I, typename... Types>
|
||||||
struct TupleOptionDetail
|
struct TupleOptionDetail
|
||||||
|
@ -175,9 +175,9 @@ bool option_add(T&, const T&)
|
||||||
template<typename EffectiveType, typename LineType, typename ColumnType>
|
template<typename EffectiveType, typename LineType, typename ColumnType>
|
||||||
inline void option_from_string(const String& str, LineAndColumn<EffectiveType, LineType, ColumnType>& opt)
|
inline void option_from_string(const String& str, LineAndColumn<EffectiveType, LineType, ColumnType>& opt)
|
||||||
{
|
{
|
||||||
auto vals = split(str, '|');
|
auto vals = split(str, tuple_separator);
|
||||||
if (vals.size() != 2)
|
if (vals.size() != 2)
|
||||||
throw runtime_error("expected <line>|<column>");
|
throw runtime_error("expected <line>"_str + tuple_separator + "<column>");
|
||||||
opt.line = str_to_int(vals[0]);
|
opt.line = str_to_int(vals[0]);
|
||||||
opt.column = str_to_int(vals[1]);
|
opt.column = str_to_int(vals[1]);
|
||||||
}
|
}
|
||||||
|
@ -185,7 +185,7 @@ inline void option_from_string(const String& str, LineAndColumn<EffectiveType, L
|
||||||
template<typename EffectiveType, typename LineType, typename ColumnType>
|
template<typename EffectiveType, typename LineType, typename ColumnType>
|
||||||
inline String option_to_string(const LineAndColumn<EffectiveType, LineType, ColumnType>& opt)
|
inline String option_to_string(const LineAndColumn<EffectiveType, LineType, ColumnType>& opt)
|
||||||
{
|
{
|
||||||
return to_string(opt.line) + '|' + to_string(opt.column);
|
return to_string(opt.line) + tuple_separator + to_string(opt.column);
|
||||||
}
|
}
|
||||||
|
|
||||||
enum YesNoAsk
|
enum YesNoAsk
|
||||||
|
|
Loading…
Reference in New Issue
Block a user