Open drount opened 2 years ago
https://github.com/ThingPulse/esp8266-oled-ssd1306/blob/057629d467d6d57a518dcbb0e09726570f1d1940/src/OLEDDisplay.cpp#L716
Hello,
in every drawStringInternal there in an increase in line height so the last check: (yMove + lineNumber * lineHeight) >= this->height()
drawStringInternal
(yMove + lineNumber * lineHeight) >= this->height()
will always be true if the texts fill all the lines of the screen.
true
In order to solve, you can break the loop just after drawing the string:
drawStringResult = drawStringInternal(xMove, yMove + (lineNumber++) * lineHeight , &text[lastDrawnPos], preferredBreakpoint - lastDrawnPos, widthAtBreakpoint, true); if (drawStringResult == 0) // we are past the display already? break; if (firstLineChars == 0) firstLineChars = preferredBreakpoint;
and return:
if ((drawStringResult + lastDrawnPos) < length) { return firstLineChars ; } return 0;
https://github.com/ThingPulse/esp8266-oled-ssd1306/blob/057629d467d6d57a518dcbb0e09726570f1d1940/src/OLEDDisplay.cpp#L716
Hello,
in every
drawStringInternal
there in an increase in line height so the last check:(yMove + lineNumber * lineHeight) >= this->height()
will always be
true
if the texts fill all the lines of the screen.In order to solve, you can break the loop just after drawing the string:
and return: