MCPcopy Create free account
hub / github.com/DISTRHO/Cardinal / SetText

Method SetText

plugins/Cardinal/src/DearImGuiColorTextEditor/TextEditor.cpp:1160–1185  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1158}
1159
1160void TextEditor::SetText(const std::string & aText)
1161{
1162 mLines.clear();
1163 mLines.emplace_back(Line());
1164 for (auto chr : aText)
1165 {
1166 if (chr == '\r')
1167 {
1168 // ignore the carriage return character
1169 }
1170 else if (chr == '\n')
1171 mLines.emplace_back(Line());
1172 else
1173 {
1174 mLines.back().emplace_back(Glyph(chr, PaletteIndex::Default));
1175 }
1176 }
1177
1178 mTextChanged = true;
1179 mScrollToTop = true;
1180
1181 mUndoBuffer.clear();
1182 mUndoIndex = 0;
1183
1184 Colorize();
1185}
1186
1187void TextEditor::SetTextLines(const std::vector<std::string> & aLines)
1188{

Callers 3

setFileMethod · 0.80
setFileWithKnownTextMethod · 0.80
setTextMethod · 0.80

Calls 4

GlyphClass · 0.85
emplace_backMethod · 0.80
backMethod · 0.80
clearMethod · 0.45

Tested by

no test coverage detected