summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* src/recur.c: Remove diff_weeks()Lukas Fleischer2011-10-211-10/+3
| | | | | | After our recur_item_inday() rewrite, this function is no longer used. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/recur.c: Support recurrent multi-day appointmentsLukas Fleischer2011-10-211-45/+50
| | | | | | | | | | | | | Completely rewrite our inday algorithm in recur_item_inday() and be more fine-grained. This version can deal with recurrent multi-day appointments unless they overlap. In case of overlapping appointments, only the last appointment that starts before the current day is shown. We will need to rewrite the whole recur_item_inday() interface in order to fix this - this relatively trivial patch is only the first step. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/apoint.c: Format recurrent multi-day items properlyLukas Fleischer2011-10-211-2/+2
| | | | | | | | | Enable "..:.." formatting for recurrent appointments that last beyond midnight. Apart from our recurrent item handler being a tad broken, there is no reason not to do the same thing we already do with regular appointments here. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Pass item durations to recur_item_inday()Lukas Fleischer2011-10-214-12/+13
| | | | | | | | Having item's durations eventually allows for better parsing of recurrent appointments as we might be interested in how many days are covered by a multi-day appointment. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Make events start on 00:00 (12:00 a.m.)Lukas Fleischer2011-10-213-6/+6
| | | | | | | | There is absolutely no reason to make events start on noon, 12:00. Switching to 00:00 seems totally reasonable here, and makes event handling a bit easier, also. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/event.c: Fix event_inday()Lukas Fleischer2011-10-211-1/+1
| | | | | | | | Nasty off-by-one error here. An event should be associated with a day if it starts at 12:00 a.m. and shouldn't be associated if it enters the next day. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* TODO: Remove the duration format improvement suggestionLukas Fleischer2011-10-211-2/+0
| | | | | | This has been implemented in the last couple of patches. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/help.c: Update messages referring to durationsLukas Fleischer2011-10-061-3/+3
| | | | | | Fix help texts to vaguely match the new duration string formats. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/apoint.c: Resize duration input fieldLukas Fleischer2011-10-061-1/+2
| | | | | | | | Now that we support more powerful duration strings, we should also resize the input field for duration strings. Twelve characters is enough space for "+999d23h59m". Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/utils.c: Support more powerful duration stringsLukas Fleischer2011-10-061-23/+100
| | | | | | | | | Add support for "1d23h42m"-like duration strings to parse_duration(). Also, switch to using a deterministic finite automaton to parse duration strings, as things tend to get unclear. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/utils.c: Remove check_time()Lukas Fleischer2011-10-062-32/+0
| | | | | | | Now that parse_time() and parse_duration() do all the validation work, this isn't used (nor needed) any longer. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Use parse_{time,duration}() where appropriateLukas Fleischer2011-10-062-43/+39
| | | | | | | | | | | | | | Make use of these new helpers at various places. Note that this patch implies a few behavioural changes: * Short forms such as "23:" and ":45" are allowed when entering times. * Durations always need to be prefixed with a plus sign ("+"), with the nice side effect that you can now use "+3:30" to declare an appointment that lasts three hours and thirty minutes (that's much more convenient than "+210"). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/utils.c: Introduce parse_{time,duration}()Lukas Fleischer2011-10-062-0/+87
| | | | | | | | | These helpers can be used in a fashion similar to parse_date(). In addition to check_time(), parse_time() and parse_duration() support short forms such as "23:" (instead of "23:00") and ":45" (instead of "00:45"). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/calcurse.h: Rework date manipulation constantsLukas Fleischer2011-10-061-5/+13
| | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/utils.c: Mark input string of parse_date() constLukas Fleischer2011-10-062-5/+5
| | | | | | | We don't mess about with the date string here, so it should be declared const. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/calcurse.c: Support count prefixes for motionsLukas Fleischer2011-10-061-19/+33
| | | | | | | | | | | | | Add a global count buffer to our main loop and pass it to keys_getch() as well as to all motion commands. This enables some fancy shortcuts: * Type "2l" to jump to the day after tomorrow. * Type "4k" (or "28l") to move forward four weeks. * Type "2$" to go to the end of next week. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Add count buffer to keys_getch()Lukas Fleischer2011-10-065-12/+27
| | | | | | | | Key commands can be prefixed with a natural number - keys_getch() will store this number in the buffer pointed to by the second parameter. Set this parameter to NULL to disable count prefixes. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Add count parameter to *_{in,de}crease()Lukas Fleischer2011-10-064-26/+26
| | | | | | | | | This allows for moving more than one item up/down. This currently isn't used anywhere but will be bound to a key with one of the following patches. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/calendar.c: Add a count parameter to calendar_move()Lukas Fleischer2011-10-063-13/+15
| | | | | | | | | Allows for moving more than one step forward/backward. This is not used anywhere yet but a key binding will likely be added in one of the following patches. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Avoid unnecessary window updatesLukas Fleischer2011-10-064-63/+111
| | | | | | | | Add a window bitmask to wins_update() and only update windows that might actually require an update in our main loop. This improves response times of the user interface a bit. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Refactor out storage updatesLukas Fleischer2011-10-061-45/+48
| | | | | | | Instead of using a hacky flag, simply move the storage update code to a separate function and call it when needed. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Remove temporary highlight pointersLukas Fleischer2011-10-063-29/+6
| | | | | | | | | Add an additional check to apoint_update_panel() and todo_update_panel() and only highlight currently selected items if the corresponding panel is active. This allows us to remove all the highlight pointer juggling that we used whenever the panel selection changed. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Use LLIST_{,TS}_FIND_FOREACH_CONT where appropriateLukas Fleischer2011-10-062-4/+4
| | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/llist.h: Add LLIST_{,TS}_FIND_FOREACH_CONTLukas Fleischer2011-10-052-0/+6
| | | | | | | | | | | | In contrast to LLIST_{,TS}_FIND_FOREACH, these convenience macros search for the first match and return successors until there is an item that isn't matched by the filter callback. Any items beyond the first cut-off are discarded. Should be used when results are known to be continuous, such as appointments and events belonging to a specific day etc. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/llist.c: Add llist_next_filter()Lukas Fleischer2011-10-053-0/+18
| | | | | | | | | | This convenience function can be used to return the successor of a list item if it is matched by a filter callback and return NULL otherwise. We will use this for an improved version of the LLIST_FIND_FOREACH macro that can be used whenever results are known to be continuous. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/llist.c: Add a tail pointerLukas Fleischer2011-10-053-6/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Adding a tail pointer to each list increases memory footprint by four bytes, while reducing the runtime of llist_add() from O(n) to O(1). In testing, the time required to append 100000 elements to a linked list was reduced from 29.245s to 0.009s. Our second main concern is to reduce the runtime of llist_add_sorted() when inserting elements from a presorted list (this is reduced from O(n) to O(1) as well), since the data files contain appointments in sorted order and are always processed front to back. Some local numbers show how this speeds up calcurse startup (test set with 50000 appointments): 0.22user 0.12system 0:00.35elapsed 99%CPU (0avgtext+0avgdata 5396maxresident)k 0inputs+8outputs (0major+1398minor)pagefaults 0swaps As opposed to the unpatched binary: 21.97user 0.25system 0:22.23elapsed 99%CPU (0avgtext+0avgdata 5388maxresident)k 0inputs+48outputs (0major+1396minor)pagefaults 0swaps This is a ~10000% increase in speed. Timings for reading random input files generated by a script stay the same (32.391s vs. 31.776s). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Add command line argument to run the GC manuallyLukas Fleischer2011-10-053-2/+27
| | | | | | | | Adds a "-g" option that allows for running the garbage collector for note files manually. This is useful for users that do not use note files at all or rarely edit/remove them. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Add configuration option to run the GC on exitLukas Fleischer2011-10-056-15/+43
| | | | | | | | If "auto_gc" is enabled, the garbage collector for note files will be run on every exit. As this is an experimental feature and may cause data loss, this is disabled by default. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Add a garbage collector for note filesLukas Fleischer2011-10-052-0/+117
| | | | | | | | | | | | Now that we use hashes to identify notes, a garbage collector comes in handy. We search for note files that aren't referenced anywhere. Such files might come up if a note, that isn't connected with any other item, is edited. Huge parts of this code are very hackish due to our data structure layout and the way our hash table implementation works. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Do not unlink() note files on note removalLukas Fleischer2011-10-058-64/+47
| | | | | | | | | | Now that we use hash-based note file names, note files should never be unlinked as a note file might be shared. Also, remove the ERASE_FORCE_KEEP_NOTE flag that no longer makes any sense. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Use hash-based file names in ical_read_note()Lukas Fleischer2011-10-051-14/+9
| | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Use hash-bashed file names in edit_note()Lukas Fleischer2011-10-051-11/+31
| | | | | | | | | | | | | | | | | | Note file names are now generated based on their content. Items using the same note will share a single note file. Please note that this implies a few changes: * Both random-style and hash-style note files need to be handled to ensure we do not break backwards compatibility. * Note files may not be moved or deleted if a note is changed or removed since the original note file might be used by another item as well. * A garbage collector to remove unreferenced note files needs to be implemented. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Accept variable length note namesLukas Fleischer2011-10-054-10/+22
| | | | | | | | Read up to the first blank in note_read() instead of assuming a fixed-width note file name. Accept everything up to 40 characters (which is the length of a SHA1 hash in hexadecimal representation). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Refactor out note deserializationLukas Fleischer2011-10-053-8/+12
| | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Add a copy file routineLukas Fleischer2011-10-052-0/+34
| | | | | | | | Add io_file_cp() which can be used to copy an existing source file to another location. We will need this for our new hash-based note file names. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Add a SHA1 implementationLukas Fleischer2011-10-053-0/+300
| | | | | | | | | | | | | | | | | | Add an implementation of the SHA1 hash algorithm based on a public domain project by Steve Reid <sreid@sea-to-sky.net>. You can get the original sources from: ftp://ftp.funet.fi/pub/crypt/hash/sha/sha1.c We will need this for several things. File names of note files will be generated based on a hash their content instead of using a random name. Items can be uniquely identified using a hash. In addition to the regular sha1_init(), sha1_update() and sha1_final() operations, our implementation also contains wrappers for hashing a string or a stream. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* doc/: Add "submitting-patches.txt"Lukas Fleischer2011-10-052-1/+196
| | | | | | | | This short paper contains information on how to create and submit patches to calcurse. This used to be on our website - "doc/" seems to be a better place for this, though. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Merge branch 'maint'Lukas Fleischer2011-09-0613-170/+250
|\ | | | | | | | | Conflicts: src/io.c
| * Release 2.9.2v2.9.2Lukas Fleischer2011-09-061-0/+8
| | | | | | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
| * Update translationsLukas Fleischer2011-09-067-46/+140
| | | | | | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
| * Add a configure setting to skip "doc/"Lukas Fleischer2011-09-033-9/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This should fix all remaining build issues with documentation generation. Finally. The new "--disable-docs" option should be used to skip documentation completely, whereas "--without-asciidoc" can be used if both manual and man page should not be rebuilt. As a consequence, "--without-asciidoc" can only be combined with "--enable-docs" if ready-made documentation already exists in "doc/". This is true for release tarballs (where we include prebuilt documentation for the sake of portability and simplicity), as well as for Git checkouts where the documentation has already been built earlier. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
| * Rework indentation code in print_notefile()Lukas Fleischer2011-08-261-3/+9
| | | | | | | | | | | | | | Do not use snprintf() here as printf() behaviour is undefined if the destination pointer is used as a parameter. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
| * src/io.c: iCal content line folding correctnessLukas Fleischer2011-08-261-112/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a rather invasive change that introduces correct line folding to our iCal parser. From now on, ical_readline() should be used instead of fgets() to read lines from an iCal file as it unfolds lines automatically. We also need to use shared buffers as each ical_readline() invocation eats up the first part of the next line and stores it in the "lstore" buffer. Subsequent ical_readline() invocations copy the contents of this buffer and append continuation lines. We currently use a single buffer pair that is allocated in io_import_data() and pass it to all subroutines. ical_readline_init() needs to be called once for every buffer pair. It reads the first part of the current line and writes to "lstore", clearing the target buffer at the same time. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Merge branch 'maint'Lukas Fleischer2011-09-028-36/+71
|\|
| * Release 2.9.1v2.9.1Lukas Fleischer2011-07-311-0/+35
| | | | | | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
| * Update translations filesLukas Fleischer2011-07-317-36/+36
| | | | | | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Add configuration option to notify all appointmentsLukas Fleischer2011-07-315-5/+35
| | | | | | | | | | | | | | | | If "notify-all" is enabled, all non-flagged appointments will be notified (instead of flagged ones). This is useful for users that want to be notified of everything. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Merge branch 'maint'Lukas Fleischer2011-07-306-71/+115
|\|
| * Fix sort order in app_arg()Lukas Fleischer2011-07-301-52/+78
| | | | | | | | | | | | | | | | | | | | | | | | We used to iterate over the list of regular appointments and the list of recurrent appointments in separate loops, thus leading to recurrent appointments being printed first and regular appointments being printed afterwards, regardless of their start and end times. Merge these loops to coerce precedence of the start time. There's still a fair bit of hackery in here - we will fix that later. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
| * Fix apoint_get() call in apoint_switch_notify()Lukas Fleischer2011-07-291-1/+1
| | | | | | | | | | | | | | We passed the function arguments the wrong way round. This regression was introduced in commit 77ef3fe76e4ce4c9a990e8a5904ad2d83420ca02. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>