MCPcopy Create free account
hub / github.com/cpeditor/cpeditor / CodeFormatter

Method CodeFormatter

src/Extensions/CodeFormatter.cpp:30–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28{
29
30CodeFormatter::CodeFormatter(Editor::CodeEditor *editor, const QString &lang, bool selectionOnly, bool logOnNoChange,
31 MessageLogger *log, QObject *parent)
32 : QObject(parent), m_editor(editor), m_lang(lang), m_selectionOnly(selectionOnly), m_logOnNoChange(logOnNoChange),
33 log(log)
34{
35 LOG_INFO(INFO_OF(lang) << INFO_OF(selectionOnly) << INFO_OF(logOnNoChange));
36
37 auto cursor = editor->textCursor();
38 m_cursorPos = cursor.position();
39 m_cursorLine = cursor.blockNumber();
40 m_cursorCol = cursor.columnNumber();
41 m_anchorPos = cursor.anchor();
42 cursor.setPosition(m_anchorPos);
43 m_anchorLine = cursor.blockNumber();
44 m_anchorCol = cursor.columnNumber();
45
46 LOG_INFO(INFO_OF(m_cursorPos) << INFO_OF(m_cursorLine) << INFO_OF(m_anchorPos) << INFO_OF(m_anchorLine));
47}
48
49void CodeFormatter::format() const
50{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected