more consistently show notes in recent changes

Teliva emits timestamps in multi-line format end in a newline. As a
result, notes get rendered on the next line and are then immediately
overwritten by the contents of the definition.

This bug was masked by my hacky 'original' timestamps which don't use
multi-line format.
This commit is contained in:
Kartik K. Agaram 2021-12-16 20:22:12 -08:00
parent 65b38f96ba
commit f979002939
1 changed files with 5 additions and 1 deletions

View File

@ -544,8 +544,12 @@ void render_recent_changes (lua_State *L, int start_index) {
/* save timestamp of binding if available */
lua_getfield(L, t, "__teliva_timestamp");
if (!lua_isnil(L, -1)) {
char buffer[128] = {0};
strncpy(buffer, lua_tostring(L, -1), 120);
if (buffer[strlen(buffer)-1] == '\n')
buffer[strlen(buffer)-1] = '\0';
attron(COLOR_PAIR(COLOR_PAIR_FADE));
printw(" %s", lua_tostring(L, -1));
printw(" %s", buffer);
attroff(COLOR_PAIR(COLOR_PAIR_FADE));
}
lua_pop(L, 1);