| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
| |
Add two new functions string_catftime(), resp. string_strftime(), which
can be used to append, resp. print, a formatted date to a dynamic
string.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
| |
Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When checking whether an appointment belongs to a given day in
apoint_inday(), the return value was 0 if the end time of the
appointment matched 00:00 on that day (because we do not want to include
appointments starting on the day before and lasting until midnight).
However, this means that punctual appointments at 00:00 were not
included in any day. Fix the apoint_inday() logic to take this into
consideration.
Fixes GitHub issue #39.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
|
|
|
| |
When adding a key already in use for another action, a warning box is
displayed. The text length is limited by the window width through the
use of strncpy(). If the limit is exceeded, the string will have no null
termination, resulting in unpredictable behaviour.
A similar problem in fatalbox() is fixed as well.
Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
| |
Check that an action is defined for the key.
Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
| |
Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
| |
Fixes GitHub issue #36.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The pair_content() function can be used to retrieve a color pair. The
foreground and the background color numbers are written to addresses
specified by the second and third parameters. While both parameters were
optional in older ncurses implementations (making it possible to pass
NULL pointers if the one does not care about either foreground or
background color), recent implementations seem to assume that both
parameters are valid pointers. Thus, instead of passing NULL, we need to
pass a pointer to a dummy variable when we do not care about the
background color.
Partly fixes GitHub issue #31.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
|
| |
In addition to checking whether a recurrent item predates the current
next appointment, we need to check that the actual occurrence of the
item predates the current appointment as well.
Fixes GitHub issue #26.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The recur_apoint_starts_before() filter function expected the second
parameter to be passed by value, whereas its only caller passed the
value by reference. For consistency with apoint_starts_after(), change
the signature and the implementation of recur_apoint_starts_before()
such that the parameter is passed by reference.
Also, add a comment to the only caller of recur_apoint_starts_before()
to clarify on why recur_apoint_starts_before() is used.
Fixes GitHub issue #25.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
| |
Make sure we never read beyond the end of the buffer, even if the
terminating quote of a quoted string is missing.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
|
|
|
| |
According to RFC 5545, iCalendar content lines can have optional
parameters, which can be quoted strings containing colons (":"). Make
sure that such colons are not interpreted as delimiters marking the
start of the value string.
Also, add a test case that covers this corner case.
Reported-by: HÃ¥kan Jerning <jerning@home.se>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
| |
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
| |
Make sure the visible region is updated after loading items, e.g. when
the users switches from the full todo list to the "uncompleted items
only" view.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
| |
Make sure that listbox_fix_visible_region() always updates the visible
region to show the entire list if it fits into the box. Also, reuse
listbox_fix_visible_region() in listbox_resize() instead of duplicating
the code.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
| |
Avoid starting multiple daemon instances if the --daemon argument is
passed and the daemon is already running. Terminate the already running
instance before spawning a new one instead.
Suggested-by: Vlad Glagolev <scm@vaygr.net>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
To prevent from illegal memory access, we checked whether the list of
todo items is empty before performing an interactive todo item action
such as flagging or removal. However, since 1a4bf2b (Add a "hide
completed" view to the todo panel, 2016-01-17), it is possible to hide
completed items from the todo panel. Thus, it may occur that the todo
list box is empty while the list of todo items is not.
To detect such situations as well, teach todo_get_item() to return NULL
if the requested item does not exist. Then, instead of checking whether
the todo item list is non-empty, make sure that the item returned by
todo_get_item() is non-NULL when performing an action.
Reported-by: Vlad Glagolev <scm@vaygr.net>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
| |
Use mem_*() wrappers instead of directly accessing libc functions when
allocating/deallocating memory.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
| |
Fixes a crash when editing the repetition of an appointment and passing
an empty repetition value.
Signed-off-by: Vlad Glagolev <scm@vaygr.net>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
| |
Remove the magic constants used in the return value of parse_datetime()
and use named flags instead.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
| |
Replace all remaining invocations of parse_time() by parse_datetime()
which now indicates whether a date was supplied or not.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
|
| |
Add support for combined date/time or date-only strings when specifying
the start or end time of a new item.
This is a follow-up to 1f39b5c (Add support for moving items to another
day, 2016-09-30).
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
| |
Create a new function that takes a time stamp and updates the date or
time components of that time stamp according to a given date/time
string. Use that function for updating the start time of an item.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When moving an item (or when changing the start time of an item), allow
for optionally specifying a date. If both date and time are entered, the
item is updated to start on the given date and time. If only a date is
entered, the item is modified to start on the given date, keeping the
current start time. If only a time is entered, the item is modified to
start on the current date and the new start time.
Fixes GitHub issue #12.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
| |
Make the function more flexible by returning the updated time instead of
single hour and minute components.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
| |
This is a follow-up to commit 65b699f (Make automatic selection of
appointments/events smarter, 2016-02-16). Newly created appointments and
events are now selected automatically.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
| |
Do not try to access freed day items. This also fixes unexpected
selection changes after modifying appointments or events.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
|
| |
Do not create an empty key bindings page if the number of bindings is a
multiple of the number of slots per page.
Also, add comments to explain the computation.
Reported-by: Kevin Wang <kevin.wang2004@hotmail.com>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
| |
This prevents from notification bar artifacts being drawn after leaving
interactive mode.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Starting the notification thread more than once can result in strange
behavior. For example, when launching external commands, only the most
recently started thread is stopped which results in the external
command's screen output being overwritten by the notification bar.
Currently, there are a couple of situations where the thread is started
twice. As a first countermeasure, explicitly check whether the thread is
already running (and terminate it) before starting a new one.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
| |
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
| |
Use a different color for days with non-recurrent items in the calendar
panel. This makes it possible to easily spot days that actually contain
appointments.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
|
|
|
| |
In commit f5d8b5e (Support durations in recurrence ending dates,
2016-02-25), we added support for the `+xxwxxd` syntax when specifying
recurrence end dates. However, this only worked when *editing* the
recurrence, not when converting a regular item to a recurrent one. Fix
this and support the new syntax in both cases.
Also, mention the new syntax in the prompt.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
| |
Fixes a regression introduced in 9e160fa (Do not assume that days always
have 86400 seconds, 2016-03-27).
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
| |
Make that date membership is computed correctly, even if a day has less
than 86400 seconds (e.g. after changing clocks).
Reported-by: Hakan Jerning <jerning@home.se>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
| |
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
| |
When spending the end date of recurring items, allow date duration
specifiers such as "+5d" or "+3w2d".
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
| |
Use the new ui_day_selitem() utility function to retrieve the currently
selected item.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
| |
Keep item selection when an item is moved (e.g. by changing the start
time or description).
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
|
|
| |
We need to manually force a reinitialization of the todo item list box
before reloading the items. Otherwise, the list box contains dangling
references to the linked list of todo items which has already been
cleared at this point. After the pre-load hook is called, the windows
are redrawn by wins_unprepare_external() and these invalid references
are accessed, leading to a segmentation fault.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
| |
* Order by start time first.
* Order items with the same start time by priority.
* Order items with the same start and priority by description.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In commit 3eae7ce (Add --list-imported command line option, 2016-01-12),
we added an option to print the hashes of imported items to stdout.
Extend this command line option such that it dumps the items using the
specified formatting strings. With the new behavior it is, for example,
easier to check items for import errors.
Also, rename the option from --list-imported to --dump-imported (it is
not part of any official release yet so we do not need to care about
backwards compatibility).
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
| |
Parse durations containing decimal numbers (such as "1.5h") gracefully.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
| |
Make sure that the monthly view cache is invalidated after the data
files are loaded.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In commit 2857bac (Fix segfault when running hooks in non-interactive
mode, 2016-01-16), we added checks to fix a segmentation fault in
non-interactive mode. However, at the same time, that commit broke
window preparation in interactive mode.
When wins_prepare_external() is called, the UI mode is changed to
command line, such that we cannot determine whether we need to call
wins_unprepare_external() when returning from the hook. As a workaround,
we now store the mode in a temporary variable.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
| |
Actually print the hash instead of raw object data.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
| |
Honor --format-* parameters when using the -G operation. In the case of
recurring items, the first occurrence is used.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
| |
Split io_save_{apts,todo}() into functions that write raw data to a file
and functions that write formatted items to stdout such that one can
easily extend the grep mode for format string support in a follow-up
commit.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
| |
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|