diff options
| author | Maxime Coste <mawww@kakoune.org> | 2019-11-24 11:39:33 +1100 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2019-11-24 18:11:29 +1100 |
| commit | 34f48cc851e73548071ffaf799e0a52be954e11f (patch) | |
| tree | 42adcdfcfad9ff535b0cc3737260253e18454ea0 /src/display_buffer.cc | |
| parent | 19e1be8e0d1946bbff02412ec703be33c7f4fede (diff) | |
Rework ncurses info display, crop content when overlflowing
Optmize the code to avoid allocating like crazy, unify various
info style rendering, crop content and display markers that there
is more text remaining.
Fixes #2257
Diffstat (limited to 'src/display_buffer.cc')
| -rw-r--r-- | src/display_buffer.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/display_buffer.cc b/src/display_buffer.cc index 20b5588c..12a234e2 100644 --- a/src/display_buffer.cc +++ b/src/display_buffer.cc @@ -179,7 +179,7 @@ ColumnCount DisplayLine::length() const return len; } -void DisplayLine::trim(ColumnCount first_col, ColumnCount col_count) +bool DisplayLine::trim(ColumnCount first_col, ColumnCount col_count) { for (auto it = begin(); first_col > 0 and it != end(); ) { @@ -199,11 +199,13 @@ void DisplayLine::trim(ColumnCount first_col, ColumnCount col_count) for (; it != end() and col_count > 0; ++it) col_count -= it->length(); + bool did_trim = it != end() || col_count < 0; if (col_count < 0) (it-1)->trim_end(-col_count); m_atoms.erase(it, end()); compute_range(); + return did_trim; } const BufferRange init_range{ {INT_MAX, INT_MAX}, {INT_MIN, INT_MIN} }; |
