summaryrefslogtreecommitdiff
path: root/src/buffer.cc
diff options
context:
space:
mode:
authorEnrico Borba <enricozb@users.noreply.github.com>2024-12-23 09:23:58 +0100
committerGitHub <noreply@github.com>2024-12-23 09:23:58 +0100
commit52125e6336d596aebdd4da91080b3178ddca7449 (patch)
tree27d3e5c01660d567f22fee621c97753f294256b0 /src/buffer.cc
parent14cb35f62b36b2f1aa530adb5e31c05ff1347bfc (diff)
parent9c458c50661446fc6e7295787b06422137af099d (diff)
Merge branch 'master' into enricozb/daemon-stdin
Diffstat (limited to 'src/buffer.cc')
-rw-r--r--src/buffer.cc12
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 };
}