aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui-day.c
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@calcurse.org>2016-02-25 21:48:39 +0100
committerLukas Fleischer <lfleischer@calcurse.org>2016-02-26 09:14:40 +0100
commitc34f9aba29b965bf1da7e16da91ebf94ae123e89 (patch)
tree84fbe45575d63ca93df3f3631af55deb867b5350 /src/ui-day.c
parent85772d746f7b1123b94ce9556273b4a9df77eeaf (diff)
downloadcalcurse-c34f9aba29b965bf1da7e16da91ebf94ae123e89.tar.gz
calcurse-c34f9aba29b965bf1da7e16da91ebf94ae123e89.zip
Refactor UTF-8 chopping
Add a function that makes sure a string does not exceed a given display size. If the string is too long, dots ("...") are appended. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
Diffstat (limited to 'src/ui-day.c')
-rw-r--r--src/ui-day.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/ui-day.c b/src/ui-day.c
index f424563..63c5da8 100644
--- a/src/ui-day.c
+++ b/src/ui-day.c
@@ -875,17 +875,17 @@ void ui_day_draw(int n, WINDOW *win, int y, int hilt, void *cb_data)
struct date slctd_date = *ui_calendar_get_slctd_day();
time_t date = date2sec(slctd_date, 0, 0);
struct day_item *item = day_get_item(n);
- int width = lb_apt.sw.w;
+ int width = lb_apt.sw.w - 2;
hilt = hilt && (wins_slctd() == APP);
if (item->type == EVNT || item->type == RECUR_EVNT) {
- day_display_item(item, win, !hilt, width, y, 1);
+ day_display_item(item, win, !hilt, width - 1, y, 1);
} else if (item->type == APPT || item->type == RECUR_APPT) {
day_display_item_date(item, win, !hilt, date, y, 1);
- day_display_item(item, win, !hilt, width, y + 1, 1);
+ day_display_item(item, win, !hilt, width - 1, y + 1, 1);
} else if (item->type == DAY_HEADING) {
- unsigned x = width - (strlen(_(monthnames[slctd_date.mm - 1])) + 17);
+ unsigned x = width - (strlen(_(monthnames[slctd_date.mm - 1])) + 15);
custom_apply_attr(win, ATTR_HIGHEST);
mvwprintw(win, y, x, "%s %s %02d, %04d",
ui_calendar_get_pom(date),