MCPcopy Create free account
hub / github.com/GilesBathgate/RapCAD / decreaseSelectionIndent

Method decreaseSelectionIndent

src/ui/codeeditor.cpp:227–246  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

225}
226
227void CodeEditor::decreaseSelectionIndent()
228{
229 int blockCount=getSelectionBlockCount();
230
231 QTextCursor cursor=textCursor();
232 cursor.setPosition(std::min(cursor.anchor(),cursor.position()));
233
234 cursor.beginEditBlock();
235 auto& p=Preferences::getInstance();
236 QString indent=p.getIndent();
237 for(auto i=0; i<=blockCount; ++i) {
238 cursor.movePosition(QTextCursor::StartOfBlock);
239 QTextCursor current(cursor);
240 current.movePosition(QTextCursor::NextCharacter,QTextCursor::KeepAnchor);
241 if(current.selectedText()==indent)
242 current.removeSelectedText();
243 cursor.movePosition(QTextCursor::NextBlock);
244 }
245 cursor.endEditBlock();
246}
247
248void CodeEditor::resizeEvent(QResizeEvent* e)
249{

Callers

nothing calls this directly

Calls 1

getIndentMethod · 0.80

Tested by

no test coverage detected