summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2018-04-29 20:33:47 +1000
committerMaxime Coste <mawww@kakoune.org>2018-04-29 20:45:53 +1000
commit2fa553e728d5600426886e6301d80807f02db533 (patch)
tree68b888309dca772ba3eb862965cdacbf975e820e /src
parentcbb91bcaed309a00f7b9de496e5adb346e3aab54 (diff)
Remove implicit conversion from String to DisplayAtom/DisplayLine
Diffstat (limited to 'src')
-rw-r--r--src/display_buffer.hh4
-rw-r--r--src/highlighters.cc2
-rw-r--r--src/insert_completer.cc14
-rw-r--r--src/ncurses_ui.cc4
-rw-r--r--src/remote.cc7
5 files changed, 15 insertions, 16 deletions
diff --git a/src/display_buffer.hh b/src/display_buffer.hh
index e284fe1f..6d20f105 100644
--- a/src/display_buffer.hh
+++ b/src/display_buffer.hh
@@ -37,7 +37,7 @@ public:
DisplayAtom(const Buffer& buffer, BufferCoord begin, BufferCoord end)
: m_type(Range), m_buffer(&buffer), m_range{begin, end} {}
- DisplayAtom(String str, Face face = Face{})
+ DisplayAtom(String str, Face face)
: m_type(Text), m_text(std::move(str)), face(face) {}
StringView content() const;
@@ -104,7 +104,7 @@ public:
DisplayLine() = default;
DisplayLine(AtomList atoms);
- DisplayLine(String str, Face face = Face{})
+ DisplayLine(String str, Face face)
{ push_back({ std::move(str), face }); }
iterator begin() { return m_atoms.begin(); }
diff --git a/src/highlighters.cc b/src/highlighters.cc
index 323257ab..d1425f39 100644
--- a/src/highlighters.cc
+++ b/src/highlighters.cc
@@ -628,7 +628,7 @@ HighlighterAndId create_column_highlighter(HighlighterParameters params)
continue;
if (target_col > 0)
- line.push_back({String{' ', target_col}});
+ line.push_back({String{' ', target_col}, {}});
line.push_back({" ", face});
}
};
diff --git a/src/insert_completer.cc b/src/insert_completer.cc
index 52f6d770..19fcaa87 100644
--- a/src/insert_completer.cc
+++ b/src/insert_completer.cc
@@ -179,12 +179,12 @@ InsertCompletion complete_word(const SelectionList& sels,
if (other_buffers && m.buffer)
{
const auto pad_len = longest + 1 - m.candidate().char_length();
- menu_entry.push_back(m.candidate().str());
- menu_entry.push_back(String{' ', pad_len});
+ menu_entry.push_back({ m.candidate().str(), {} });
+ menu_entry.push_back({ String{' ', pad_len}, {} });
menu_entry.push_back({ m.buffer->display_name(), faces["MenuInfo"] });
}
else
- menu_entry.push_back(m.candidate().str());
+ menu_entry.push_back({ m.candidate().str(), {} });
candidates.push_back({m.candidate().str(), "", std::move(menu_entry)});
return true;
@@ -226,7 +226,7 @@ InsertCompletion complete_filename(const SelectionList& sels,
{
for (auto& filename : Kakoune::complete_filename(prefix,
options["ignored_files"].get<Regex>()))
- candidates.push_back({ filename, "", filename });
+ candidates.push_back({ filename, "", {filename, {}} });
}
else
{
@@ -246,7 +246,7 @@ InsertCompletion complete_filename(const SelectionList& sels,
options["ignored_files"].get<Regex>()))
{
StringView candidate = filename.substr(dir.length());
- candidates.push_back({ candidate.str(), "", candidate.str() });
+ candidates.push_back({ candidate.str(), "", {candidate.str(), {}} });
}
visited_dirs.push_back(std::move(dir));
@@ -316,7 +316,7 @@ InsertCompletion complete_option(const SelectionList& sels,
auto& menu = std::get<2>(candidate);
match.menu_entry = not menu.empty() ?
parse_display_line(expand_tabs(menu, tabstop, column), faces)
- : DisplayLine{ expand_tabs(menu, tabstop, column) };
+ : DisplayLine{ expand_tabs(menu, tabstop, column), {} };
matches.push_back(std::move(match));
}
@@ -368,7 +368,7 @@ InsertCompletion complete_line(const SelectionList& sels,
{
StringView candidate = line.substr(0_byte, line.length()-1);
candidates.push_back({candidate.str(), "",
- expand_tabs(candidate, tabstop, column)});
+ {expand_tabs(candidate, tabstop, column), {}}});
// perf: it's unlikely the user intends to search among >10 candidates anyway
if (candidates.size() == 100)
break;
diff --git a/src/ncurses_ui.cc b/src/ncurses_ui.cc
index 9514af07..a8a2cc1f 100644
--- a/src/ncurses_ui.cc
+++ b/src/ncurses_ui.cc
@@ -382,7 +382,7 @@ void NCursesUI::draw_line(NCursesWin* window, const DisplayLine& line,
}
}
-static const DisplayLine empty_line = String(" ");
+static const DisplayLine empty_line = { String(" "), {} };
void NCursesUI::draw(const DisplayBuffer& display_buffer,
const Face& default_face,
@@ -438,7 +438,7 @@ void NCursesUI::draw_status(const DisplayLine& status_line,
{
DisplayLine trimmed_mode_line = mode_line;
trimmed_mode_line.trim(mode_len + 2 - remaining, remaining - 2);
- trimmed_mode_line.insert(trimmed_mode_line.begin(), { "…" });
+ trimmed_mode_line.insert(trimmed_mode_line.begin(), { "…", {} });
kak_assert(trimmed_mode_line.length() == remaining - 1);
ColumnCount col = m_dimensions.column - remaining + 1;
diff --git a/src/remote.cc b/src/remote.cc
index 1113144c..d3879f28 100644
--- a/src/remote.cc
+++ b/src/remote.cc
@@ -290,15 +290,14 @@ Color MsgReader::read<Color>()
template<>
DisplayAtom MsgReader::read<DisplayAtom>()
{
- DisplayAtom atom(read<String>());
- atom.face = read<Face>();
- return atom;
+ String content = read<String>();
+ return {std::move(content), read<Face>()};
}
template<>
DisplayLine MsgReader::read<DisplayLine>()
{
- return DisplayLine(read_vector<DisplayAtom>());
+ return {read_vector<DisplayAtom>()};
}
template<>