MCPcopy Create free account
hub / github.com/ProgerXP/Notepad2e / SetText

Method SetText

scintilla/src/PerLine.cxx:414–433  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

412}
413
414void LineAnnotation::SetText(int line, const char *text) {
415 if (text && (line >= 0)) {
416 annotations.EnsureLength(line+1);
417 int style = Style(line);
418 if (annotations[line]) {
419 delete []annotations[line];
420 }
421 annotations[line] = AllocateAnnotation(static_cast<int>(strlen(text)), style);
422 AnnotationHeader *pah = reinterpret_cast<AnnotationHeader *>(annotations[line]);
423 pah->style = static_cast<short>(style);
424 pah->length = static_cast<int>(strlen(text));
425 pah->lines = static_cast<short>(NumberLines(text));
426 memcpy(annotations[line]+sizeof(AnnotationHeader), text, pah->length);
427 } else {
428 if (annotations.Length() && (line >= 0) && (line < annotations.Length()) && annotations[line]) {
429 delete []annotations[line];
430 annotations[line] = 0;
431 }
432 }
433}
434
435void LineAnnotation::ClearAll() {
436 for (int line = 0; line < annotations.Length(); line++) {

Callers 2

MarginSetTextMethod · 0.80
AnnotationSetTextMethod · 0.80

Calls 5

StyleClass · 0.85
AllocateAnnotationFunction · 0.85
NumberLinesFunction · 0.85
EnsureLengthMethod · 0.80
LengthMethod · 0.45

Tested by

no test coverage detected