| 76 | |
| 77 | |
| 78 | void CursesUI::outputMessage(const std::string& msg, ColorCode color) { |
| 79 | // add message to the message buffer, remove the oldest message if it's full |
| 80 | if (msgBuffer.size() == maxBufferSize) { |
| 81 | msgBuffer.erase(msgBuffer.begin()); |
| 82 | } |
| 83 | std::pair<std::string, ColorCode> p(msg, color); |
| 84 | msgBuffer.push_back(p); |
| 85 | |
| 86 | // if we have scrolled away from the bottom, don't show the new message |
| 87 | if (scrollOffset == 0) { |
| 88 | wattron(mainWin, COLOR_PAIR(color)); |
| 89 | waddstr(mainWin, (msg + "\n").c_str()); |
| 90 | wattroff(mainWin, COLOR_PAIR(color)); |
| 91 | wrefresh(mainWin); |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | |
| 96 | void CursesUI::handleNewPacket(uint16_t code) { |
no test coverage detected