diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2012-08-15 18:06:59 +0200 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2012-08-15 18:06:59 +0200 |
| commit | 390d4ccdfc18d6f9e9827014fc7b7f4bbc2381dc (patch) | |
| tree | bc68b75f70fb07538d3d911f8d7fd596564368bc /src/buffer.hh | |
| parent | 260b30e6d90eee942e965d3d96038fb6632b763a (diff) | |
Buffer::{iterator_at,clamp} takes an optional avoid_eol parameter
when avoid_eol is true, clamping does avoid end-of-line if possible
Diffstat (limited to 'src/buffer.hh')
| -rw-r--r-- | src/buffer.hh | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/buffer.hh b/src/buffer.hh index b048dbe5..a0d19836 100644 --- a/src/buffer.hh +++ b/src/buffer.hh @@ -130,11 +130,16 @@ public: BufferSize character_count() const; BufferSize line_count() const; - BufferIterator iterator_at(const BufferCoord& line_and_column) const; + // returns an iterator at given coordinates. line_and_column is + // clamped according to avoid_eol. + BufferIterator iterator_at(const BufferCoord& line_and_column, + bool avoid_eol = false) const; BufferCoord line_and_column_at(const BufferIterator& iterator) const; // returns nearest valid coordinates from given ones - BufferCoord clamp(const BufferCoord& line_and_column) const; + // if avoid_eol, clamp to character before eol if line is not empty + BufferCoord clamp(const BufferCoord& line_and_column, + bool avoid_eol = false) const; const String& name() const { return m_name; } |
