summaryrefslogtreecommitdiff
path: root/src/display_buffer.hh
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2019-09-17 19:06:49 +1000
committerMaxime Coste <mawww@kakoune.org>2019-09-25 22:46:39 +1000
commit2eccbbbe6fe2589f9133b7e5702832e21b26e8cf (patch)
tree7cc2a28e271d151ab11fd2194e7ce2d9d3717d78 /src/display_buffer.hh
parentf855deaf8b50e6ac6aa030d32769ac175ab75a2d (diff)
Avoid unnecessary allocations in NCursesUI::Window::draw calls
Pass an ArrayView<DisplayAtom> instead of a DisplayLine& so that the newly common case of passing a single atom does not require constructing a Vector.
Diffstat (limited to 'src/display_buffer.hh')
-rw-r--r--src/display_buffer.hh3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/display_buffer.hh b/src/display_buffer.hh
index 045a1cc8..1c8fc53d 100644
--- a/src/display_buffer.hh
+++ b/src/display_buffer.hh
@@ -30,6 +30,9 @@ public:
DisplayAtom(String str, Face face)
: face(face), m_type(Text), m_text(std::move(str)) {}
+ explicit DisplayAtom(String str)
+ : DisplayAtom(std::move(str), Face{}) {}
+
StringView content() const;
ColumnCount length() const;