MCPcopy Create free account
hub / github.com/LadybugDB/ladybug / openBracket

Function openBracket

tools/shell/linenoise.cpp:1609–1625  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1607}
1608
1609static void openBracket(std::vector<uint64_t>& brackets, std::vector<uint64_t>& cursor_brackets,
1610 uint64_t pos, uint64_t i) {
1611 // check if the cursor is at this position
1612 if (pos == i) {
1613 // cursor is exactly on this position - always highlight this bracket
1614 if (!cursor_brackets.empty()) {
1615 cursor_brackets.clear();
1616 }
1617 cursor_brackets.push_back(i);
1618 }
1619 if (cursor_brackets.empty() && ((i + 1) == pos || (pos + 1) == i)) {
1620 // cursor is either BEFORE or AFTER this bracket and we don't have any highlighted bracket
1621 // yet highlight this bracket
1622 cursor_brackets.push_back(i);
1623 }
1624 brackets.push_back(i);
1625}
1626
1627static void closeBracket(std::vector<uint64_t>& brackets, std::vector<uint64_t>& cursor_brackets,
1628 uint64_t pos, uint64_t i, std::vector<uint64_t>& errors) {

Callers 1

addErrorHighlightingFunction · 0.85

Calls 3

emptyMethod · 0.45
clearMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected