MCPcopy Create free account
hub / github.com/BruceDevices/firmware / addLine

Method addLine

src/core/scrollableTextArea.cpp:129–157  ·  view source on GitHub ↗

for devices it will act as a scrollable text area

Source from the content-addressed store, hash-verified

127
128// for devices it will act as a scrollable text area
129void ScrollableTextArea::addLine(const String &text) {
130 if (text.isEmpty()) {
131 linesBuffer.emplace_back("");
132 return;
133 }
134
135 String buff;
136 size_t start = 0;
137 bool firstLine = true;
138
139 // Automatically split into multiple lines
140 while (start < text.length()) {
141 size_t len = _maxCharactersPerLine;
142
143 if (!firstLine && _indentWrappedLines) {
144 buff = " " + text.substring(start, start + len - 1); // Reduce length for space
145 start += len - 1;
146 } else {
147 buff = text.substring(start, start + len);
148 start += len;
149 }
150 if (buff.endsWith("\r")) buff.remove(buff.length() - 1);
151
152 linesBuffer.emplace_back(buff);
153 firstLine = false;
154 }
155
156 _redraw = true;
157}
158
159void ScrollableTextArea::draw(bool force) {
160 if (!_redraw && !force) return;

Callers 14

fillInfoFunction · 0.80
setupMethod · 0.80
hf14aMfReadDumpModeMethod · 0.80
hf14aMfuReadDumpModeMethod · 0.80
hf14aMfuWriteDumpModeMethod · 0.80
hf14aMfWriteDumpModeMethod · 0.80
hf14aMfWriteDumpMethod · 0.80
hf15ReadDumpModeMethod · 0.80
hf15WriteDumpModeMethod · 0.80
loadIso15693DumpFileMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected