MCPcopy Create free account
hub / github.com/Rezonality/zep / FindNextMarker

Method FindNextMarker

src/buffer.cpp:1304–1339  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1302}
1303
1304std::shared_ptr<RangeMarker> ZepBuffer::FindNextMarker(GlyphIterator start, Direction dir, uint32_t markerType)
1305{
1306 start.Clamp();
1307
1308 std::shared_ptr<RangeMarker> spFound;
1309 auto search = [&]() {
1310 ForEachMarker(markerType, dir, Begin(), End(), [&](const std::shared_ptr<RangeMarker>& marker) {
1311 if (dir == Direction::Forward)
1312 {
1313 if (marker->GetRange().first <= start.Index())
1314 {
1315 return true;
1316 }
1317 }
1318 else
1319 {
1320 if (marker->GetRange().first >= start.Index())
1321 {
1322 return true;
1323 }
1324 }
1325
1326 spFound = marker;
1327 return false;
1328 });
1329 };
1330
1331 search();
1332 if (spFound == nullptr)
1333 {
1334 // Wrap
1335 start = (dir == Direction::Forward ? Begin() : End());
1336 search();
1337 }
1338 return spFound;
1339}
1340
1341void ZepBuffer::SetBufferType(BufferType type)
1342{

Callers 2

GetCommandMethod · 0.80
HandleExCommandMethod · 0.80

Calls 2

GetRangeMethod · 0.80
IndexMethod · 0.80

Tested by

no test coverage detected