Add String Range::content() const

This commit is contained in:
Maxime Coste 2013-02-27 19:11:25 +01:00
parent 9230667c11
commit 2f410f62e4
3 changed files with 8 additions and 1 deletions

View File

@ -119,7 +119,7 @@ std::vector<String> Editor::selections_content() const
{
std::vector<String> contents;
for (auto& sel : m_selections)
contents.push_back(m_buffer->string(sel.begin(), sel.end()));
contents.push_back(sel.content());
return contents;
}

View File

@ -24,6 +24,11 @@ BufferIterator Range::end() const
return utf8::next(std::max(m_first, m_last));
}
String Range::content() const
{
return m_first.buffer().string(begin(), end());
}
void Range::check_invariant() const
{
#ifdef KAK_DEBUG

View File

@ -31,6 +31,8 @@ public:
// returns max(first, last) + 1
BufferIterator end() const;
String content() const;
void check_invariant() const;
private:
BufferIterator m_first;