| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
|
| |
Shortened repetition type text.
Avoid "duration" in until-contexts (reserve it for appointment duration):
"duration" changed to "increment" in user texts as well as source.
Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
| |
In addition, the prompt text is shortened.
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>
|
|
|
|
|
|
|
|
|
|
|
| |
The help command has been updated for "repeat".
Context dependent, very terse information is built into the repeat
command (edit command) for display in the status bar when editing the
Weekdays, Months and Monthdays lists.
Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
|
| |
Code duplication has been eliminated by calling update_rept() from the
repeat command ui_day_item_repeat().
The repeat command asks for simple or advanced repetition.
Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The function update_rept() is extended with editing of the three
recurrence rule lists for BYMONTH, BYMONTHDAY and BYDAY.
The integers of the bymonth and bymonthday lists are edited directly as
integers, while those of the bywday list are mapped to localized weekday
names (as they appear in the calendar panel) with an optional integer
prefix (in RFC5545 style: 1MO, -2SA).
The RFC5545 (icalendar) requirement that the start day must be the first
occurrence and must match the recurrence rule, is met by testing that an
occurrence indeed appears on the start day, in these circumstances:
- when a recurrent item is loaded from file
- when the recurrence rule of an item is edited interactively
- when a recurrent appointment gets a new start time
- when a recurrent appointment is moved
Copy and paste of a recurrent item will only retain the basic recurrence
properties of type, frequency, until and exception days.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Terms and concepts are from RFC 5545 (the iCalendar specification).
Overall design
--------------
Calcurse is extended with full support for BYMONTH, BYDAY and BYMONTHDAY
recurrence rule (rrule) parts. The three rule parts are lists of,
respectively, months, weekdays and monthdays. The lists are added to
'struct rpt' as linked lists of integers, and the data file format is
extended accordingly (details below). Load and save of the lists follow
the pattern of the existing list of exception dates, also in 'struct
rpt'.
The function recur_item_find_occurence() is split into a front-end and a
back-end. The back-end, called find_occurrence(), is the original
function extended with rrule reductions; the front-end retains the
original name and performs rrule expansions. Front-end plus back-end are
backwards compatible and require no changes in calling functions.
There is no user interface in this patch.
Data file extensions
--------------------
The BYMONTH, BYDAY and BYMONTHDAY lists are added to that part of an
item line which describes the recurrence rule (the "{...}" part). Each
list is - like the list of exception days - a space-separated string of
values identified by the initial character. Each list is optional and,
if present, must follow the until date and precede the exception day
list. The lists must appear in order BYMONTHDAY list, BYDAY list and
BYMONTH list.
The possible list values are
- BYMONTH: m1, m2, ..., m12
- BYDAY: w0, w1, ..., w6, w7, w-7, w8, w-8, ..., w377, w-377
- BYMONTHDAY: d1, d2, ..., d31, d-1, d-2, ..., d-31
which are interpreted as (cf. RFC 5545)
- BYMONTH: January, February, ..., December.
- BYDAY: SU, MO, ..., SA, +1SU, -1SU, +1MO, -1MO, ..., +53SA, -53SA
- BYMONTHDAY: the first, the second, ..., the 31st, the last,
the last but one, ..., the last but 30 day of the month
Examples:
Thursday, TH, is w4; Saturday, SA, is w6.
The seventh Thursday, +7TH, is w53 (7 * 7 + 4 = 53); the last but second
Saturday, -2SA, is w-20 (2 * 7 + 6 = 20); the last day of the month is
d-1.
Note that the values w-1, w-2, ..., w-6 are not used.
A recurrent appointment with a BYDAY rule part:
06/23/2019 @ 12:00 -> 06/23/2019 @ 13:00 {1W w0 w6} |every week on Sunday and Saturday
An event with a BYDAY and a BYMONTH rule part:
10/27/2019 [1] {1Y w-7 m10} every year on last Sunday in October
An event with until date, a BYMONTH rule part and an exception day:
06/23/2019 [1] {1Y -> 08/31/2021 m5 m6 m7 !07/23/2020} every year on the 23rd in May, June and July for three years, starting on Sunday, 23 June 2019, but not on 23 July 2020.
Recurrence set expansion and reduction
---------------------------------------
In calcurse a recurrence rule is a quadruple (s, d, r, e) consisting of
start, duration, repetition pattern and exception days and is
implemented as:
(time_t start, long dur, struct rpt *rpt, llist_t *exc)
In RFC 5545 parlance, a recurrence rule defines a recurrence set
consisting of all recurrence instances (occurrences) not earlier than
start which match the rule pattern. With this concept in mind,
recur_item_find_occurremce() may be thought of as a membership function
for a recurrence set. The call
recur_item_find_occurrence(s, d, r, e, day, occurrence)
returns true if day belongs to the recurrence set of (s, d, r, e); if so
occurrence points to the recurrence instance (the set member).
For a recurrence rule with only the basic DAYLY, WEEKLY, MONTHLY or
YEARLY type and frequency the recurrence set consists of periodically
repeated instances. The BYxxx rule parts modify the recurrence set by
reducing or expanding it as specified by RFC 5545.
Expansion is implemented in the front-end by modifications of start
and/or frequency of the rule (s, d, r, e), often several times, in such
a way that the desired recurrence instances are included in the
recurrence set. This is possible because the front-end as the very first
thing checks for early days (day < s). When day is known not to be
early, start (s) can safely be moved backwards. Likewise, if frequency
must be changed, the front-end checks whether the frequency repetition
applies to the week, month or year of day.
Reduction is easier and is performed in the back-end along with the
existing validity checks. It consists in checking whether month, day of
month or weekday of a found occurrence is on the appropriate list.
Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The patch contains no functional changes, but is a necessary
precondition for extensions of update_rept() (in ui-day.c) with further
recurrence rules.
The reason is that recurrence parameters must be treated as a whole: if
an edit session is cancelled at any point, no value should change, and
all parameters should remain as they were. Hence, the new values must
only be set after all of them have been determined. This was not the
case for the list of exception days, but as long as it was treated last,
it did not matter.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The recurrence parameters are type, frequency, until date and exception
list (in RFC 5545 parlance FREQ, INTERVAL, UNTIL and EXDATE's). When
these are passed in a function call, the argument list becomes long and
not very readable. When support for extended recurrence rules is
implemented, the number of recurrence parameters increases, and function
signatures must be amended.
Solution: The "struct rpt" is extended with the exception list; any
future recurrence parameters are added here. A pointer to this structure
replaces the recurrence parameters in function calls.
Note: Each recurrent event and appoinment instance has (a pointer to) a
"struct rpt" and in addition an exception list. The latter is retained
to avoid the derived changes, and the exception list in the structure is
initialized to an empty list when the recurrent instance is created.
Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
| |
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
|
| |
Register REG_BLACK_HOLE can neither be copied into nor pasted from and
has been removed from the input routine.
Register 36 was not used.
Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A day begins on midnight (inclusive) and ends on midnight (exclusive). A
day as a whole is represented by the initial midnight, i.e. time-of-day
is 00:00.
On load of recurrent appointments (but not events) time-of-day for the
until day is set to 23:59. For a newly created recurrent appointment the
setting depends on the input method: time-of-day is set to 00:00 if
until day is given as a date (day, month and year), but to time-of-day
for the start day if given as an offset (+dd).
The resulting behaviour is only visible in interactive use of calcurse
as proved by the following scenario.
1) Create an appointment with start time 12:00, end time 11:59 (multi
day).
2) Turn it into a recurrent appointment of type daily, frequency 3,
until day +3.
The appointment is correctly displayed with two 2-day occurrences three
days apart.
3) Edit the appointment and select Repetition. Accept existing type,
frequency and end day (now as a date).
The second day of the second occurrence disappears.
4) Repeat 3), but set the end day as an offset (+3).
The second day of the second occurrence reappears.
The inconsistencies have been eliminated, and time-of-day for the until
day is now always 00:00.
Also, until day may equal start day, so midnights should be compared.
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>
|
|
|
|
|
|
|
|
| |
An edit session, and in particular, a cancelled edit session should encompass
all parameters.
Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
| |
Since commit 987fa9d (Allow to omit end date in repetitions,
2019-06-03), one can provide an empty date instead of using the value 0
to omit the end date of a repetition. Use this as default value when
editing repetitions without an end date.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
| |
Addresses GitHub issue #213.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
| |
Fixes a regression introduced in 223810c (Major overhaul of
appointment/event input routines., 2017-11-06) and 16d3032 (Refactoring
update_duration/day_edit_duration., 2017-10-18).
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
... by adding a horizontal line from border to border above the day
heading and turning the event separator into an empty line. The
horizontal line is left out for the first day loaded.
Also reduce the number of empty lines at the end of a day to at most
one.
A new configuration variable, header_line, turns the horizontal line on
and off.
Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously, with only one day visible at a time, the appointments panel
displayed the details of the day selected in the calendar (slctd_day);
information required for operations on items (day_items) can often be
derived from the selected day. The items available are derived from the
selected day. In particular, the selected item is derived from the
selected day.
With multiple days in the APP panel, the relation between selected day
(in the calendar) and the selected item (in the APP panel) has, in a
way, been turned around. The selected item may now be moved between days
without explicitly changing the selected day. Implicitly it is changed
when the target day of a move is unavailable.
This commit draws the full consequence: the selected day in the calendar
is always (set to) the day of the selected item in the APP panel.
The static variable 'struct date slctd_day' lives in ui_calendar.c and
is accessible through various public functions. To these are added
ui_calendar_set_slctd_day() which sets slctd_day directly.
The selected day retains its significance for load of the day vector (in
day_store_items()): the range of loaded days begins with the selected
day. Movements (up/down) in the APP panel will change the selected day
as the selected item moves among the already loaded days. Only when the
target of a movement is unreachable, will further days be loaded. On the
other hand, if the same range of days must be reloaded because of a
changed item, the selected item - and with it the selected day - must be
reset to the first day item (see do_storage()).
Movements in the calendar (generic-next-day, etc.) are not affected and
behave as previously, i.e. they will cause a range of days to be loaded
with the selected day as the first and the selected item as the first of
the selected day.
Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The number of days displayed in the APP panel has been made
configurable, maximum 21 days, default seven days.
With several days in the APP panel, it may be desirable to "squeeze" the
entries by leaving out the final empty line of each appointment and
lower the number of lines between consecutive days (0, 1, or 2). Both
are made general configuration options. To make a uniform display, an
empty line is added to a day without appointments, if appointments have
an empty line.
Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
With multiple days in the APP panel, up/down movements should change
behaviour at the top and bottom of the list displayed, and load the
previous/next lot of days.
This requires that the move function returns the result of the
operation. Furthermore, the ability to move the selection to the
beginning of a day is needed when moving down (in order to move from the
first day to the last day). For this reason a DAY_SEPARATOR has been
inserted also after the last day of a lot.
Appointments have a listbox height of three to separate them clearly
when there is more than one in a day. This leaves a spurious empty line
at the end of a day with appointments. The DAY_SEPARATOR height is
reduced from two to one, and a new EMPTY_SEPARATOR of height one is
inserted in any day with only events.
When scrolling up the DAY_HEADING becomes visible when the selection
reaches the first item of the day.
The length of the separator (between events and appointments) is
adjusted to leave a space to the window border at both ends, thereby
making it a part of the day, not a separation between days.
The dummy event must also be recognisable when not the selected item and
is only inserted in interactive mode.
The test for a saved selection must also recognise caption items which
have item pointer NULL.
The function day_get_nb() has been renamed day_get_days().
Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The day vector, day_items, is displayed in the appointments panel; the
selected day_item object is highlighted (when the panel has the focus).
When items are inserted, edited, moved etc., and when the day is
changed, the day vector is rebuilt and displayed anew.
Problem: How shall the selection be set automatically in the context of
the new day vector?
In previous versions all of the above is mostly handled by the function
do_storage() in calcurse.c The function saves data about the selection
as needed, rebuilds the day vector, loads the listbox and sets the
selection from the saved selection data. This works well in "single
day" calcurse in cases where the selected item is present in the day
vector both before and after the rebuild, or when the item ordering in
the listbox is unaffected by the changes. But when a new item is added
the selection cannot be set to the new object by do_storage(). Instead
the necessary operations are performed by ui_day_item_add(), and
do_storage() is bypassed. In general, when an item cannot be found in
the new vector, the item which occupies the old place in the list gets
selected, e.g. when an item is deleted. When an item is turned into a
repeating one, the old item is deleted and a new is created. Here the
new selection is not always the affected item, but in any case not far
away. Generally, with only one day in the panel an erronous selection
might not be noticed or be accurate by chance.
In "multiple day" calcurse the existing scheme works less well; in
addition the day vector may now contain more than one object that refer
to the same event or appointment (recurrent items or multi-day
appointments). The scheme has therefore been modified. The do_storage()
function is no longer bypassed, but handles day vector rebuild, load of
listbox and item selection exclusively. To make that possible, data
about the selected item is no longer saved in a local automatic
variable, private to do_storage(), but in an external static variable in
day.c, which may be set not only by do_storage(). The variable is
declared as
static struct day_item sel_data;
and used as follows:
1. On startup sel_data is initialized to empty (i.e. no selection).
2. In any operation involving the appointments panel:
2.1 Do the work and if necessary set sel_data. This is the case when
deleting, adding or pasting an item, and when turning an ordinary
item into a recurrent one.
2.2 Call do_storage().
3. In do_storage():
3.1 If sel_data is empty, set it to the current selection.
3.2 Rebuild the day vector.
3.3 Set the selection from sel_data.
3.4 Set sel_data to empty.
Further remarks
---------------
The selection is found in the new day vector by searching for the saved
(order, item.<pointer>) pair. Previously the item.<pointer> alone
sufficed and in some cases it still does. In case the item cannot be
found, the selection stays in the same day as before the rebuild.
An attempt at more consistently named APP-related functions has led to:
ui_day_sel_date() replaces ui_day_sel_day() ui_day_get_sel() replaces
ui_day_selitem()
Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Overview of existing implementation
-----------------------------------
The APP panel displays the 'day_items' vector in the 'lb_apt' listbox. A
listbox consists of a scrollwin (structure) in which a number of items
is displayed. The listbox keeps track of:
- the number of items
- the selected item
- the type of each item in an array type[]
- the height of each item (ie. how many screen lines) in an array ch[]
- how to display an item (on the screen)
The latter three are handled by functions fn_type(), fn_height(),
fn_draw(). The first two are used to fill in the corresponding array
entry, type[] or ch[], for item number i, the third draws item number i.
The items are taken from the global variables
vector_t day_items
int day_items_nb
in day.c. Items include captions (DAY_HEADING, DAY_SEPARATOR).
Everything is sorted for display (DAY_HEADING, events, DAY_SEPARATOR,
appts). These are filled in ("stored") [by day_store_items() for the
selected day in the calendar], before being "loaded" into the listbox.
See do_storage() in calcurse.c and ui_day_item_add() in ui-day.c.
New APP panel design
--------------------
Several days are displayed in the APP panel by loading them with
day_store_items().
With several days come several headings and separators. DAY_SEPARATOR is
reinterpreted to separate days, and a new separator, EVNT_SEPARATOR,
separates events from appointments. To sort everything, an 'order'
member of type time_t is added to the day_item structure. It is set for
headings and separators as well as for appointments and events as
follows:
item order
---------------------
DAY_HEADING BGNOFDAY (= midnight)
EVNT_SEPARATOR BGNOFDAY
DAY_SEPARATOR ENDOFDAY
event start time (midnight)
appointment start time (first day)
BGNOFDAY (following days, if any)
The sort function day_cmp() (used by vector_sort) is extended to sort by
order first.
The order field always indicates the day to which an item belongs. This
comes in handy, because with several days in the APP panel it is
necessary to distinguish between the selected day in the calendar and
the selected day in the APP panel. This raises the question which day
should actions (commands) operate on: the one selected in the calendar
or the one selected in the APP panel? Unquestionably the one on the APP
panel which is the one tacitly implied. In most cases it is not a
problem, though, because actions work on the selected item and the
selected day does not come into play. But in some cases it does:
delete item When deleting an occurrence of a repeated item, the
selected day is the exception day to add.
view item day_popup_item() needs the day of the selected item
for display of correct start/end times.
cut/paste item Paste needs the selected day in which to paste.
add item The day of the new item is taken from the calendar.
Instead a dummy event is inserted in an empty day.
This makes the day selectable, which is otherwise
impossible with only the DAY_HEADING displayed. The
dummy event is selectable but cannot be edited or
deleted (but viewed or piped).
With more than one day in the day_items vecter, an appointment spanning
more than one day may occur more than once in the vector (with start/end
times suitably adjusted for display). A day_item is no longer (always)
identified by the aptev_ptr (item) value. Instead the combination
(order, item.<ptr>) is used; order is roughly the day.
Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
|
|
| |
The function day_process_storage() is a wrapper for day_store_items().
It has an unused second argument, and is only used twice to load the
selected day. It has been removed.
A new function, get_slctd_day(), is the equivalant of get_today() and
replaces the very awkwardly named ui_calendar_get_slctd_day_sec().
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
|
|
|
| |
The exception days are presented for viewing/editing as a string of
space-separated dates (in the user-preferred input format). After
editing the string is checked for valid dates, but there is no check
that a date is meaningful (an occurrence day of the item between start
day and until day). Although possible, it is best to add exception days
in the usual way by deletion of occurrences.
Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
| |
Removing an occurrence of a recurrent item can turn a busy day into a
free day.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
|
| |
When the selected day in the calendar is a continuation day (not the first day)
of such an appointment, deleting the occurrence does not work. The reason is
that the selected day, and not the first day of the occurrence, is added as an
exception day.
Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
| |
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Calcurse saves time and date information on disk as local time in readable text
file format. When loaded from disk or when entered by the user, local time is
converted to Unix time (seconds since 00:00:00, 1 January 1970). When
displayed, and later when saved to disk, the Unix time is converted back to
readable local time. Both conversions depend on DST.
Hence, if midnight for a day with DST in effect (i.e. local time) is converted,
increased with an amount and converted back, the amount has changed if DST is
_not_ in effect for the resulting time. In general, calculations on Unix time
variables should be used with caution because of the DST-dependent conversions.
Instead, the calculations should be performed on local time data with the help
of mktime().
The commit fixes start time for pasted appointments (ordinary and recurrent)
and the 'until'-date of recurrent appointments, pasted as well as new and
edited. The latter problem is slightly different in that the adjustment is a
number of days, as it is for exception dates.
Update of the date in parse_datetime() has been corrected to be similar to
update of the time, although no problem has been identified.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
| |
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
| |
Memory pointers must be initialized at the start in case memory is
freed (cleanup) before it is allocated.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
| |
Use one (small) buffer long enough to hold a date.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When setting start time for a new appointment, a date is disallowed
(in all other cases both time and date are still allowed).
Both date and time are displayed for the user to correct when an
appointment is changed or moved.
Built-in help in the status bar for display of input formats.
Several bug fixes that resulted in data inconsistencies (end time
before start time).
The routines use the enhanced parsing funtions to validate input:
ui_day_item_add(void)
parse_datetime()
parse_duration()
parse_datetime()
ui_day_item_repeat(void)
parse_date_duration()
parse_date()
ui_day_item_edit(void)
update_start_time()
day_edit_time()
parse_datetime()
update_duration()
parse_duration()
parse_datetime()
update_rept()
parse_date_duration()
parse_date()
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
| |
Incorporated day_edit_duraton() into update_duration().
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
|
| |
When editing the start time, move the item instead of keeping the
previous start time as end time. When editing the end time, start with
an empty end time instead of the previous start time.
Fixes GitHub issue #89.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Due to deficient validation, it is possible to get an inconsistent
database with an appointment that ends before it begins. Edit an
existing one and specify an end time by a date that precedes the start
date, or create a new one and give a date as end time that precedes the
start. Then exit calcurse; on restart it will report a data error and
exit.
Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
|
|
|
| |
You try to enter an appointment, but enter an invalid start time (by
mistake). Calcurse rejects the input. You enter the correct start time
and calcurse asks for the description, not the end time, i.e. you get an
event.
The check for an event must only be performed on valid input.
Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When a scrollbar is on display in APP or TOD windows, the right
vertical border (outside the scrollbar) is not highlighted
when the window is selected.
The scrollbar is always highlighted:
- when APP or TOD is deselected
- in configuration windows where borders otherwise are not
The patch moves the scrollbar parameters (except highlight)
from arguments of draw_scrollbar() to the function itself.
The highlight argument was 1; instead it is set higher in
the call hierarchy (wins_update_panels()) and passed on down.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
| |
Add a wrapper around parse_date() which picks the current input date
format as well as the currently selected day and passes both values to
parse_date(), alongside with the parameters passed to
parse_date_interactive() itself.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
| |
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
| |
The date at the top of the appointments list may be positioned either to
the left, in the middle or to the right. Default is to the right. Can be
configured from the general options menu.
Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
|
| |
The computation never really worked before and it seems like the feature
is not very helpful, sometimes even confusing (see GitHub issue #21).
The macro ISLEAP is moved to calcurse.h.
Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
|
|
|
| |
When introducing the fmt_day_heading() function in commit d56cc7a (Make
heading in appointments panel configurable, 2017-08-19), we forgot to
initialize the dynamic string. This resulted in calling mem_free() with
a garbage pointer, potentially resulting in a segmentation fault. Fix
this by calling string_init() before using the string.
Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
| |
Introduce a new function keys_wait_for_any_key() and use it instead of
wgetch() whenever the return value is discarded.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
|
|
|
|
| |
Add a new configuration variable format.dayheading to set the format of
the date displayed at the top of the event and appointment list.
Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
|
|
|
|
| |
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>
|