MCPcopy Create free account
hub / github.com/Codeya-IDE/deepin-ide / reformatBlocks

Method reformatBlocks

src/plugins/git/highlighter/basehighlighter.cpp:58–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56}
57
58void BaseHighlighterPrivate::reformatBlocks(int from, int charsRemoved, int charsAdded)
59{
60 rehighlightWorking = false;
61 QTextBlock block = doc->findBlock(from);
62 if (!block.isValid())
63 return;
64
65 int endPosition;
66 QTextBlock lastBlock = doc->findBlock(from + charsAdded + (charsRemoved > 0 ? 1 : 0));
67 if (lastBlock.isValid())
68 endPosition = lastBlock.position() + lastBlock.length();
69 else
70 endPosition = doc->lastBlock().position() + doc->lastBlock().length();
71
72 bool forceHighlightOfNextBlock = false;
73 while (block.isValid() && (block.position() < endPosition || forceHighlightOfNextBlock)) {
74 const int stateBeforeHighlight = block.userState();
75 reformatBlock(block, from, charsRemoved, charsAdded);
76 forceHighlightOfNextBlock = (block.userState() != stateBeforeHighlight);
77 block = block.next();
78 }
79
80 formatChanges.clear();
81}
82
83void BaseHighlighterPrivate::reformatBlock(const QTextBlock &block, int from, int charsRemoved, int charsAdded)
84{

Callers

nothing calls this directly

Calls 5

lastBlockMethod · 0.80
isValidMethod · 0.45
lengthMethod · 0.45
nextMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected