This commit is contained in:
e2002
2025-08-25 16:45:25 +03:00
parent 1b644d7895
commit 3cc8450f23
7 changed files with 10 additions and 10 deletions

View File

@@ -167,14 +167,14 @@ void ScrollWidget::setText(const char* txt) {
#ifdef PSFBUFFER
_fb->fillRect(0, 0, _width, _textheight, _bgcolor);
_fb->setCursor(0, 0);
snprintf(_window, _width / _charWidth + 1, "%s", _text); //TODO
snprintf(_window, _width / _charWidth + 2, "%s", _text); //TODO
_fb->print(_window);
_fb->display();
#endif
} else {
dsp.fillRect(_config.left, _config.top, _width, _textheight, _bgcolor);
dsp.setCursor(_config.left, _config.top);
snprintf(_window, _width / _charWidth + 1, "%s", _text); //TODO
snprintf(_window, _width / _charWidth + 2, "%s", _text); //TODO
dsp.setClipping({_config.left, _config.top, _width, _textheight});
dsp.print(_window);
dsp.clearClipping();
@@ -235,10 +235,10 @@ void ScrollWidget::_draw() {
const char* _cursor = _text + _newx / _charWidth;
uint16_t hiddenChars = _cursor - _text;
if (hiddenChars < strlen(_text)) {
snprintf(_window, _width / _charWidth + 1, "%s%s%s", _cursor, _sep, _text);
snprintf(_window, _width / _charWidth + 2, "%s%s%s", _cursor, _sep, _text);
} else {
const char* _scursor = _sep + (_cursor - (_text + strlen(_text)));
snprintf(_window, _width / _charWidth + 1, "%s%s", _scursor, _text);
snprintf(_window, _width / _charWidth + 2, "%s%s", _scursor, _text);
}
if(_fb->ready()){
#ifdef PSFBUFFER