diff options
| author | Igor Ramazanov <igor.ramazanov@protonmail.com> | 2025-01-18 11:43:57 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-18 11:43:57 +0000 |
| commit | ce4dc805e375dbd8c0477ad5005c2110f83de2aa (patch) | |
| tree | ac2ca142a2182eb51ed64ffd029fa4111b4d8f48 /src/buffer.cc | |
| parent | ae9758e95f531d26847cfc7e884da3ceb47670f3 (diff) | |
| parent | 54084900624493033cb24640d864c109cdac40a7 (diff) | |
Merge branch 'mawww:master' into contrib/gendocs.sh
Diffstat (limited to 'src/buffer.cc')
| -rw-r--r-- | src/buffer.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/buffer.cc b/src/buffer.cc index ada61ad8..f0205c54 100644 --- a/src/buffer.cc +++ b/src/buffer.cc @@ -570,17 +570,17 @@ void Buffer::notify_saved(FsStatus status) m_fs_status = status; } -BufferCoord Buffer::advance(BufferCoord coord, ByteCount count) const +BufferCoord Buffer::advance(ArrayView<const StringDataPtr> lines, BufferCoord coord, ByteCount count) { if (count > 0) { auto line = coord.line; count += coord.column; - while (count >= m_lines[line].length()) + while (count >= lines[(size_t)line]->length) { - count -= m_lines[line++].length(); - if (line == line_count()) - return end_coord(); + count -= lines[(size_t)line++]->length; + if ((size_t)line == lines.size()) + return line; } return { line, count }; } @@ -592,7 +592,7 @@ BufferCoord Buffer::advance(BufferCoord coord, ByteCount count) const { if (--line < 0) return {0, 0}; - count += m_lines[line].length(); + count += lines[(size_t)line]->length; } return { line, count }; } |
