diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2013-04-03 19:22:12 +0200 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2013-04-04 14:04:37 +0200 |
| commit | 1fd99e7e88c48d503a07b8a53580622467ae407f (patch) | |
| tree | 878121c0581af6ea4879c01f22a559480ab0bbfc /src/editor.cc | |
| parent | 4fbe2dc6bc2522e79558fcb1af19d0cad947ea83 (diff) | |
do not check buffer invariant in do_{erase,insert} as this cause O(n²) behaviour
Diffstat (limited to 'src/editor.cc')
| -rw-r--r-- | src/editor.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/editor.cc b/src/editor.cc index ef2d0a9b..6b058f3a 100644 --- a/src/editor.cc +++ b/src/editor.cc @@ -88,10 +88,10 @@ void Editor::insert(const String& str, InsertMode mode) { sel.first() = pos; sel.last() = str.empty() ? pos : utf8::character_start(pos + str.length() - 1); - sel.check_invariant(); } sel.avoid_eol(); } + check_invariant(); } void Editor::insert(const memoryview<String>& strings, InsertMode mode) @@ -110,10 +110,10 @@ void Editor::insert(const memoryview<String>& strings, InsertMode mode) { sel.first() = pos; sel.last() = str.empty() ? pos : utf8::character_start(pos + str.length() - 1); - sel.check_invariant(); } sel.avoid_eol(); } + check_invariant(); } std::vector<String> Editor::selections_content() const @@ -408,6 +408,7 @@ void Editor::check_invariant() const assert(not m_selections.empty()); assert(m_main_sel < m_selections.size()); m_selections.check_invariant(); + buffer().check_invariant(); assert(std::is_sorted(m_selections.begin(), m_selections.end(), compare_selections)); #endif } |
