mirror of
https://github.com/mawww/kakoune.git
synced 2024-12-25 04:24:48 +03:00
Buffer: minor refactoring
This commit is contained in:
parent
8acb25d9a4
commit
c1db67e31a
@ -86,11 +86,6 @@ BufferCoord Buffer::clamp(const BufferCoord& line_and_column,
|
||||
return result;
|
||||
}
|
||||
|
||||
BufferIterator Buffer::iterator_at_line_begin(const BufferIterator& iterator) const
|
||||
{
|
||||
return BufferIterator(*this, { iterator.line(), 0 });
|
||||
}
|
||||
|
||||
BufferIterator Buffer::iterator_at_line_begin(LineCount line) const
|
||||
{
|
||||
line = Kakoune::clamp(line, 0_line, line_count()-1);
|
||||
@ -98,11 +93,9 @@ BufferIterator Buffer::iterator_at_line_begin(LineCount line) const
|
||||
return BufferIterator(*this, { line, 0 });
|
||||
}
|
||||
|
||||
BufferIterator Buffer::iterator_at_line_end(const BufferIterator& iterator) const
|
||||
BufferIterator Buffer::iterator_at_line_begin(const BufferIterator& iterator) const
|
||||
{
|
||||
LineCount line = iterator.line();
|
||||
assert(line_length(line) > 0);
|
||||
return ++BufferIterator(*this, { line, line_length(line) - 1 });
|
||||
return iterator_at_line_begin(iterator.line());
|
||||
}
|
||||
|
||||
BufferIterator Buffer::iterator_at_line_end(LineCount line) const
|
||||
@ -112,6 +105,11 @@ BufferIterator Buffer::iterator_at_line_end(LineCount line) const
|
||||
return ++BufferIterator(*this, { line, line_length(line) - 1 });
|
||||
}
|
||||
|
||||
BufferIterator Buffer::iterator_at_line_end(const BufferIterator& iterator) const
|
||||
{
|
||||
return iterator_at_line_end(iterator.line());
|
||||
}
|
||||
|
||||
BufferIterator Buffer::begin() const
|
||||
{
|
||||
return BufferIterator(*this, { 0_line, 0 });
|
||||
|
Loading…
Reference in New Issue
Block a user