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

Method appendCustomText

src/common/widget/outputpane.cpp:174–202  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

172}
173
174void OutputPane::appendCustomText(const QString &textIn, AppendMode mode, const QTextCharFormat &format)
175{
176 if (d->maxCharCount > 0 && d->outputEdit->document()->characterCount() >= d->maxCharCount) {
177 qDebug() << "Maximum limit exceeded : " << d->maxCharCount;
178 return;
179 }
180
181 if (!d->cursor.atEnd())
182 d->cursor.movePosition(QTextCursor::End);
183
184 if (mode == OverWrite) {
185 d->cursor.select(QTextCursor::LineUnderCursor);
186 d->cursor.removeSelectedText();
187 }
188
189 auto text = mode == OverWrite ? textIn.trimmed() : normalizeNewlines(doNewlineEnforcement(textIn));
190 d->cursor.insertText(text, format);
191
192 if (d->maxCharCount > 0 && d->outputEdit->document()->characterCount() >= d->maxCharCount) {
193 QTextCharFormat tmp;
194 tmp.setFontWeight(QFont::Bold);
195 d->cursor.insertText(doNewlineEnforcement(tr("Additional output omitted") + QLatin1Char('\n')), tmp);
196 }
197
198 if (!d->filterText.isEmpty())
199 filterContent(false, false);
200
201 scrollToBottom();
202}
203
204void OutputPane::appendText(const QString &text, OutputFormat format, AppendMode mode)
205{

Callers

nothing calls this directly

Calls 7

characterCountMethod · 0.80
atEndMethod · 0.80
selectMethod · 0.80
removeSelectedTextMethod · 0.80
documentMethod · 0.45
insertTextMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected