MCPcopy Create free account
hub / github.com/dail8859/NotepadNext / toggleLine

Method toggleLine

src/ScintillaCommenter.cpp:49–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47}
48
49void ScintillaCommenter::toggleLine(int line)
50{
51 auto indentPos = editor->lineIndentPosition(line);
52 auto lineEnd = qMin(indentPos + editor->languageSingleLineComment.length(), editor->lineEndPosition(line));
53 const QByteArray commentText = editor->get_text_range(indentPos, lineEnd);
54
55 if (commentText == editor->languageSingleLineComment) {
56 editor->deleteRange(indentPos, editor->languageSingleLineComment.length());
57
58 st.trackDeletion(indentPos, editor->languageSingleLineComment.length());
59 }
60 else {
61 if (indentPos == editor->lineEndPosition(line)) {
62 return;
63 }
64
65 editor->insertText(indentPos, editor->languageSingleLineComment.constData());
66
67 st.trackInsertion(indentPos, editor->languageSingleLineComment.length());
68 }
69}
70
71void ScintillaCommenter::commentLine(int line)
72{

Callers

nothing calls this directly

Calls 3

lengthMethod · 0.80
trackDeletionMethod · 0.80
trackInsertionMethod · 0.80

Tested by

no test coverage detected