diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-12-16 20:22:12 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-12-16 20:22:12 -0800 |
commit | f979002939a7a7d5f323eb1a3e583de2cab542e7 (patch) | |
tree | 1b43e1e14c7c9072d86f50c64967ff859237b3e4 /src | |
parent | 65b38f96ba83ff5a38b779a1e451a19841a833fa (diff) | |
download | teliva-f979002939a7a7d5f323eb1a3e583de2cab542e7.tar.gz |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/lua.c | 6 |
1 files changed, 5 insertions, 1 deletions
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); |