From f979002939a7a7d5f323eb1a3e583de2cab542e7 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Thu, 16 Dec 2021 20:22:12 -0800 Subject: 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. --- src/lua.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/lua.c b/src/lua.c index 0e38e6f..5e67928 100644 --- a/src/lua.c +++ b/src/lua.c @@ -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); -- cgit 1.4.1-2-gfad0