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

Method insertNewLineBelowCurrentLine

src/scintillaeditview.cpp:3032–3049  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3030}
3031
3032void ScintillaEditView::insertNewLineBelowCurrentLine(bool)
3033{
3034 QString newline = getEOLString();
3035 const auto line_count = execute(SCI_GETLINECOUNT);
3036 const auto current_line = getCurrentLineNumber();
3037 if (current_line == line_count - 1)
3038 {
3039 // Special handling if caret is at last line.
3040 appandGenericText(newline.toUtf8());
3041 }
3042 else
3043 {
3044 const auto eol_length = newline.length();
3045 const auto position = eol_length + execute(SCI_GETLINEENDPOSITION, current_line);
3046 insertCharsFrom(position, newline.toUtf8());
3047 }
3048 execute(SCI_SETEMPTYSELECTION, execute(SCI_POSITIONFROMLINE, current_line + 1));
3049}
3050
3051void ScintillaEditView::sortLines(size_t fromLine, size_t toLine, ISorter* pSort)
3052{

Callers 1

Calls 1

lengthMethod · 0.45

Tested by

no test coverage detected