diff options
author | Lukas Fleischer <lfleischer@calcurse.org> | 2022-12-25 16:30:21 -0500 |
---|---|---|
committer | Lukas Fleischer <lfleischer@calcurse.org> | 2022-12-25 16:36:27 -0500 |
commit | ce6f8bf85b54640b467c59318b7506e4db18bd83 (patch) | |
tree | 5372002ac1e91f2b511e1c8be3a08dcbb1e9c4ac /src/ui-todo.c | |
parent | 7b350ac58f34c81d01f5cd6b0b36f6ec5c93c68e (diff) | |
download | calcurse-ce6f8bf85b54640b467c59318b7506e4db18bd83.tar.gz calcurse-ce6f8bf85b54640b467c59318b7506e4db18bd83.zip |
Extend default description to all item types
Show default description "(empty description)" for all types of items
(appointments, events, recurring appointments/events, TODOs).
Follow-up to 7b350ac (Add text for displaying empty event description,
2022-06-21).
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
Diffstat (limited to 'src/ui-todo.c')
-rw-r--r-- | src/ui-todo.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/ui-todo.c b/src/ui-todo.c index c715250..b65b8d3 100644 --- a/src/ui-todo.c +++ b/src/ui-todo.c @@ -207,14 +207,16 @@ void ui_todo_draw(int n, WINDOW *win, int y, int hilt, void *cb_data) if (hilt) custom_apply_attr(win, ATTR_HIGHEST); - if (utf8_strwidth(todo->mesg) < width) { - mesg = todo->mesg; - } else { + mesg = todo->mesg; + if (mesg[0] == '\0') + mesg = EMPTY_EVENT_DESC_DEFAULT; + + if (utf8_strwidth(mesg) >= width) { width -= 3; - for (j = 0; todo->mesg[j] && width > 0; j++) { - if (!UTF8_ISCONT(todo->mesg[j])) - width -= utf8_width(&todo->mesg[j]); - buf[j] = todo->mesg[j]; + for (j = 0; mesg[j] && width > 0; j++) { + if (!UTF8_ISCONT(mesg[j])) + width -= utf8_width(&mesg[j]); + buf[j] = mesg[j]; } if (j) { buf[j - 1] = '.'; |