diff options
| author | Maxime Coste <mawww@kakoune.org> | 2017-06-07 11:40:13 +0100 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2017-06-07 11:40:13 +0100 |
| commit | 21da24235aaa9c40ccff032565b9f31ccd1ba178 (patch) | |
| tree | a66ccc1e8eecf3b9f6998e025f22757425d07225 /src/buffer.cc | |
| parent | 5a5d2ad7cbe19099ae2128be9921bc174e6b119f (diff) | |
Small style tweak
Diffstat (limited to 'src/buffer.cc')
| -rw-r--r-- | src/buffer.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/buffer.cc b/src/buffer.cc index 5dca738e..14821f79 100644 --- a/src/buffer.cc +++ b/src/buffer.cc @@ -196,7 +196,8 @@ BufferCoordAndTarget Buffer::offset_coord(BufferCoordAndTarget coord, LineCount String Buffer::string(BufferCoord begin, BufferCoord end) const { String res; - for (auto line = begin.line; line <= end.line and line < line_count(); ++line) + const auto last_line = std::min(end.line, line_count()-1); + for (auto line = begin.line; line <= last_line; ++line) { ByteCount start = 0; if (line == begin.line) |
