MCPcopy Create free account
hub / github.com/cxasm/notepad-- / convertSelectedTextTo

Method convertSelectedTextTo

src/scintillaeditview.cpp:2813–2840  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2811}
2812
2813void ScintillaEditView::convertSelectedTextTo(const TextCaseType & caseToConvert)
2814{
2815 int selectionStart = execute(SCI_GETSELECTIONSTART);
2816 int selectionEnd = execute(SCI_GETSELECTIONEND);
2817
2818 int strLen = (selectionEnd - selectionStart);
2819 if (strLen != 0)
2820 {
2821 int strSize = strLen + 1;
2822
2823 char *selectedStr = new char[strSize];
2824
2825 execute(SCI_GETSELTEXT, 0, reinterpret_cast<sptr_t>(selectedStr));
2826
2827 QString utf8Str(selectedStr);
2828 changeCase(caseToConvert, utf8Str);
2829
2830 QByteArray bytes = utf8Str.toUtf8();
2831
2832 execute(SCI_SETTARGETRANGE, selectionStart, selectionEnd);
2833
2834 execute(SCI_BEGINUNDOACTION);
2835 execute(SCI_REPLACETARGET, strLen, reinterpret_cast<sptr_t>(bytes.data()));
2836 execute(SCI_ENDUNDOACTION);
2837 execute(SCI_SETSEL, selectionStart, selectionEnd);
2838 delete[] selectedStr;
2839 }
2840}
2841
2842//获取当前选择的行范围
2843std::pair<size_t, size_t> ScintillaEditView::getSelectionLinesRange(intptr_t selectionNumber /* = -1 */) const

Callers 1

transCurUpperOrLowerMethod · 0.80

Calls 1

dataMethod · 0.80

Tested by

no test coverage detected