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.
This commit is contained in:
Allan Odgaard
2016-09-11 08:33:07 +02:00
parent 8676827ede
commit b57cde0886

View File

@@ -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