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

Method rangeText

src/plugins/codeeditor/gui/tabwidget.cpp:545–564  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

543}
544
545QString TabWidget::rangeText(const QString &fileName, const dpfservice::Edit::Range &range, bool &found)
546{
547 if (auto editor = d->findEditor(fileName)) {
548 found = true;
549 int startPos = editor->positionFromLineIndex(range.start.line,
550 range.start.column == -1
551 ? 0
552 : range.start.column);
553 int endPos = range.end.column == -1
554 ? editor->SendScintilla(TextEditor::SCI_GETLINEENDPOSITION, range.end.line)
555 : editor->positionFromLineIndex(range.end.line, range.end.column);
556 if (startPos == -1 || endPos == -1)
557 return {};
558
559 return editor->text(startPos, endPos);
560 }
561
562 found = false;
563 return {};
564}
565
566Edit::Range TabWidget::selectionRange(const QString &fileName, bool &found)
567{

Callers 4

readContextMethod · 0.45
askForChatMethod · 0.45
createFormatCodeMethod · 0.45
startMethod · 0.45

Calls 4

findEditorMethod · 0.80
positionFromLineIndexMethod · 0.80
SendScintillaMethod · 0.45
textMethod · 0.45

Tested by

no test coverage detected