summaryrefslogtreecommitdiff
path: root/src/input_handler.cc
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2017-08-29 10:01:43 +0700
committerMaxime Coste <mawww@kakoune.org>2017-08-29 10:01:43 +0700
commit1709886873b9c655ca0183a0711adf61709bb29f (patch)
tree1b24c7631ad7d9af8a8fc5ce7656bcbcdcbbe4d8 /src/input_handler.cc
parent24234dffa3035a471126173d478d5ae215fb620e (diff)
avoid literal eol in status lines, replace them with another symbol
Diffstat (limited to 'src/input_handler.cc')
-rw-r--r--src/input_handler.cc25
1 files changed, 4 insertions, 21 deletions
diff --git a/src/input_handler.cc b/src/input_handler.cc
index 797719f9..debae2d8 100644
--- a/src/input_handler.cc
+++ b/src/input_handler.cc
@@ -500,23 +500,6 @@ public:
DisplayLine build_display_line(ColumnCount in_width)
{
- auto cleanup = [](StringView str) {
- String res;
- auto pos = str.begin();
- for (auto it = str.begin(), end = str.end(); it != end; ++it)
- {
- char c = *it;
- if (c == '\n' or c == '\r')
- {
- res += StringView{pos, it};
- res += c == '\n' ? "␤" : "␍";
- pos = it+1;
- }
- }
- res += StringView{pos, str.end()};
- return res;
- };
-
CharCount width = (int)in_width; // Todo: proper handling of char/column
kak_assert(m_cursor_pos <= m_line.char_length());
if (m_cursor_pos < m_display_pos)
@@ -525,12 +508,12 @@ public:
m_display_pos = m_cursor_pos + 1 - width;
if (m_cursor_pos == m_line.char_length())
- return DisplayLine{{ { cleanup(m_line.substr(m_display_pos, width-1)), get_face("StatusLine") },
+ return DisplayLine{{ { fix_atom_text(m_line.substr(m_display_pos, width-1)), get_face("StatusLine") },
{ " "_str, get_face("StatusCursor")} } };
else
- return DisplayLine({ { cleanup(m_line.substr(m_display_pos, m_cursor_pos - m_display_pos)), get_face("StatusLine") },
- { cleanup(m_line.substr(m_cursor_pos,1)), get_face("StatusCursor") },
- { cleanup(m_line.substr(m_cursor_pos+1, width - m_cursor_pos + m_display_pos - 1)), get_face("StatusLine") } });
+ return DisplayLine({ { fix_atom_text(m_line.substr(m_display_pos, m_cursor_pos - m_display_pos)), get_face("StatusLine") },
+ { fix_atom_text(m_line.substr(m_cursor_pos,1)), get_face("StatusCursor") },
+ { fix_atom_text(m_line.substr(m_cursor_pos+1, width - m_cursor_pos + m_display_pos - 1)), get_face("StatusLine") } });
}
private:
CharCount m_cursor_pos = 0;