Skip to content

The last character of an unterminated log line does not get printed in drawLogBuffer #362

@Max-Plastix

Description

@Max-Plastix

Describe the bug
When printing characters to the screen without a terminating new-line, the LogBuffer is correctly displayed, except for the very last character, which is omitted from the display.

To Reproduce
Steps to reproduce the behavior:

  1. Configure SSD1306Wire * display
  2. use display->print() to print a line ending in \n -- no problem.
  3. use display->print() to print a line without a \n -- all but the last character is displayed
  4. print another character, and the first missing character appears

Sample code

void OLEDDisplay::drawLogBuffer(uint16_t xMove, uint16_t yMove) {
...
    drawStringInternal(xMove, yMove + line * lineHeight, &this->logBuffer[lastPos], length, 0);

May be related to the problem, as logBuffer[lastPos] may point to the newline character \n itself, from the
lastPos=i in the loop above.

Expected behavior
Each character, including the last printable character, should appear on the last line of the log display

Versions (please complete the following information):
ESP8266 and ESP32 OLED driver for SSD1306 displays by Daniel Eichhorn, ThingPulse
4.2.1
pulled in by PlatformIO

lib_deps =
thingpulse/ESP8266 and ESP32 OLED driver for SSD1306 displays

Additional context
Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions