From b57cde08869a102ae75e9ec4e35df40f8d78ce10 Mon Sep 17 00:00:00 2001 From: Allan Odgaard Date: Sun, 11 Sep 2016 08:33:07 +0200 Subject: [PATCH] Improve implementation of document_view_t::has_marks The previous version was proportional in time with number of marks, since it requested (a copy of) all the marks. --- Frameworks/OakTextView/src/OakTextView.mm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Frameworks/OakTextView/src/OakTextView.mm b/Frameworks/OakTextView/src/OakTextView.mm index 8acc97bc..05e76e3b 100644 --- a/Frameworks/OakTextView/src/OakTextView.mm +++ b/Frameworks/OakTextView/src/OakTextView.mm @@ -284,8 +284,7 @@ struct document_view_t : ng::buffer_api_t bool has_marks (std::string const& type = NULL_STR) const { - ng::buffer_t const& buf = [_document_editor buffer]; - return type == NULL_STR ? !buf.get_marks(0, buf.size()).empty() : !buf.get_marks(0, buf.size(), type).empty(); + return [_document_editor buffer].prev_mark(SIZE_T_MAX, type).second != NULL_STR; } bool current_line_has_marks (std::string const& type) const