Remove unused only_buffer mode for DisplayLine::trim

This commit is contained in:
Maxime Coste 2017-06-09 15:30:13 +01:00
parent 7b9d8d39b1
commit 0dec1e3a91
3 changed files with 4 additions and 10 deletions

View File

@ -168,16 +168,10 @@ ColumnCount DisplayLine::length() const
return len; return len;
} }
void DisplayLine::trim(ColumnCount first_col, ColumnCount col_count, bool only_buffer) void DisplayLine::trim(ColumnCount first_col, ColumnCount col_count)
{ {
for (auto it = begin(); first_col > 0 and it != end(); ) for (auto it = begin(); first_col > 0 and it != end(); )
{ {
if (only_buffer and not it->has_buffer_range())
{
++it;
continue;
}
auto len = it->length(); auto len = it->length();
if (len <= first_col) if (len <= first_col)
{ {

View File

@ -128,7 +128,7 @@ public:
// remove first_col from the begining of the line, and make sure // remove first_col from the begining of the line, and make sure
// the line is less that col_count character // the line is less that col_count character
void trim(ColumnCount first_col, ColumnCount col_count, bool only_buffer); void trim(ColumnCount first_col, ColumnCount col_count);
// Merge together consecutive atoms sharing the same display attributes // Merge together consecutive atoms sharing the same display attributes
void optimize(); void optimize();

View File

@ -430,7 +430,7 @@ void NCursesUI::draw_status(const DisplayLine& status_line,
else if (remaining > 2) else if (remaining > 2)
{ {
DisplayLine trimmed_mode_line = mode_line; DisplayLine trimmed_mode_line = mode_line;
trimmed_mode_line.trim(mode_len + 2 - remaining, remaining - 2, false); 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); kak_assert(trimmed_mode_line.length() == remaining - 1);
@ -733,7 +733,7 @@ void NCursesUI::menu_show(ConstArrayView<DisplayLine> items,
for (auto& item : items) for (auto& item : items)
{ {
m_menu.items.push_back(item); m_menu.items.push_back(item);
m_menu.items.back().trim(0, maxlen, false); m_menu.items.back().trim(0, maxlen);
kak_assert(m_menu.items.back().length() <= maxlen); kak_assert(m_menu.items.back().length() <= maxlen);
} }