diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2012-08-15 17:55:58 +0200 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2012-08-15 17:55:58 +0200 |
| commit | 260b30e6d90eee942e965d3d96038fb6632b763a (patch) | |
| tree | c851918ce084f8da13860a992279e39c56f26cdd /src | |
| parent | 346108ec62700cefc292768d455589b5366e8997 (diff) | |
misc cleanups
Diffstat (limited to 'src')
| -rw-r--r-- | src/buffer.cc | 3 | ||||
| -rw-r--r-- | src/filters.cc | 3 | ||||
| -rw-r--r-- | src/highlighters.cc | 4 |
3 files changed, 4 insertions, 6 deletions
diff --git a/src/buffer.cc b/src/buffer.cc index 8cec62d2..76a2009d 100644 --- a/src/buffer.cc +++ b/src/buffer.cc @@ -98,7 +98,8 @@ BufferIterator Buffer::iterator_at_line_begin(const BufferIterator& iterator) co BufferIterator Buffer::iterator_at_line_end(const BufferIterator& iterator) const { BufferPos line = iterator.line(); - return ++BufferIterator(*this, { line, std::max(line_length(line) - 1, 0) }); + assert(line_length(line) > 0); + return ++BufferIterator(*this, { line, line_length(line) - 1 }); } BufferIterator Buffer::begin() const diff --git a/src/filters.cc b/src/filters.cc index 4a392545..8df8b597 100644 --- a/src/filters.cc +++ b/src/filters.cc @@ -43,8 +43,7 @@ void expand_tabulations(Buffer& buffer, BufferIterator& position, String& conten if (content == "\t") { int column = 0; - BufferCoord pos = buffer.line_and_column_at(position); - for (auto line_it = buffer.iterator_at({pos.line, 0}); + for (auto line_it = buffer.iterator_at_line_begin(position); line_it != position; ++line_it) { assert(*line_it != '\n'); diff --git a/src/highlighters.cc b/src/highlighters.cc index 09ef7e65..d41456c4 100644 --- a/src/highlighters.cc +++ b/src/highlighters.cc @@ -188,10 +188,8 @@ void expand_tabulations(Window& window, DisplayBuffer& display_buffer) if (it+1 != end) atom_it = line.split(atom_it, it+1); - BufferCoord pos = it.buffer().line_and_column_at(it); - int column = 0; - for (auto line_it = it.buffer().iterator_at({pos.line, 0}); + for (auto line_it = it.buffer().iterator_at_line_begin(it); line_it != it; ++line_it) { assert(*line_it != '\n'); |
