summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2013-01-30Use strncasecmp() for case-insensitive comparisonLukas Fleischer
Instead of converting everything to upper case and then using strncmp(), use strncasecmp() which does case-insensitive comparison out of the box. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-01-30Remove unused function mystrtol()Lukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-01-30custom.c: Fix sidebar configuration help textLukas Fleischer
* Use a format string instead of the TOSTRING() macro. * Remove "xgettext:no-c-format" hack and use "%%" instead. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-12-16do_storage(): Unset highlighted item if list is emptyLukas Fleischer
Check if the appointment panel contains any items and unset the highlight counter if it doesn't. Not doing this resulted in core dumps if the edit command was invoked after switching to a day without any appointments/events. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-12-16Display correct startup messagesLukas Fleischer
These messages have been swapped accidentally during refactoring. Regression introduced in 691f8a6015bafcf6ed4f99a3649d428fb7a8e915. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-12-16Add hidden key handler windowLukas Fleischer
After BUG#6 had apparently been closed with the screen locks introduced in commit a80f8dcf2c6eb3b54658218bc081ee9694204dd5, some people still had problems with random characters appearing in the notification bar. This was obviously caused by wgetch() refreshing the screen if the status panel was changed. From wgetch(3): If the window is not a pad, and it has been moved or modified since the last call to wrefresh, wrefresh will be called before another character is read. Since the wgetch(3) isn't thread-safe, there were race conditions between the notification bar thread drawing to the notification bar and wgetch() updating the screen. Introduce a (hidden) window that handles all key presses and never gets changed in order to avoid this. Also, call wins_wrefresh() explicitly in status_mesg(), since we can no longer rely on wgetch() updating windows automatically. Fixes reopened BUG#6. Note that this is a hotfix -- FR#26 has been opened to ensure we fix this properly in the next major release. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-12-06Fix two enumeration types in function signaturesLukas Fleischer
Spotted with clang and "-Wconversion". Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-12-06keys.c: Remove several unneeded assertionsLukas Fleischer
Seen when compiling with clang and "-Wtautological-compare". Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-12-06wins_show(): Fix size of the slave window arrayLukas Fleischer
The slave window array was just big enough to hold a single element, whereas two elements are written/accessed. Fix this off-by-one error in the array declaration. Note that this messed up the panel layout when using clang as a compiler. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-12-05io_load_keys(): Skip legacy entryLukas Fleischer
This binding was used pre-3.1.0. Simply ignore it and avoid showing a needlessly complicated error message. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-12-05keys_save_bindings(): Skip unset key bindingsLukas Fleischer
Saving unset key bindings currently results in a segmentation fault or invalid key specifiers being stored. Skip these entries to avoid this. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-11-29Merge branch 'maint'Lukas Fleischer
2012-11-28Ignore signals during command executionLukas Fleischer
Disable signal handlers in wins_prepare_external() and reactivate them in wins_unprepare_external(). Before, it was possible that resizing the window during editor/pager mode resulted in the calcurse main screen appearing on top. Addresses BUG#9. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-11-26Merge branch 'maint'Lukas Fleischer
2012-11-26day.c: Fix weekly viewLukas Fleischer
Calculate busy slices correctly if (recurrent) appointments with a duration of more than 24 hours are used. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-11-26io_check_*()/io_file_exist(): Fix signaturesLukas Fleischer
This was broken in commit 87fb8cfec0d8e8fc901746095458bd316314b6ee. Fix function signatures and update all invocations accordingly. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-11-25io.c: Several minor simplificationsLukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-11-25args.c: Several minor simplificationsLukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-11-25Replace switch block in layout calculationLukas Fleischer
Remove the huge layout switch block and use simple calculations instead. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-11-25Add compact panels supportLukas Fleischer
Add a configuration option that allows for switching to compact panel mode. In this mode, all window labels are hidden, so that there's more space for actual information. This patch doesn't add a configuration menu entry and doesn't add any documentation. Implements FR#7. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-11-25Avoid core dump if window is too smallLukas Fleischer
Avoid setting the maximum number of items to a negative number (which eventually results in a core dump). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-11-25Add configuration option to set a default panelLukas Fleischer
This allows for customizing the panel that is selected by default when calcurse is started. Note that this patch doesn't add any documentation. Also, this configuration option currently cannot be configured using the configuration menu. Implements FR#19. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-11-25Remove wins_slctd_init()Lukas Fleischer
We only call this once. Remove the wrapper and directly call the wrapped function instead. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-11-23io_load_*(): Add line numbers to error messagesLukas Fleischer
Currently, error messages for (syntax) errors do not contain any line number information. Add the file name and line number to allow users for easily locating any errors in the corresponding data files. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-11-23Merge branch 'maint'Lukas Fleischer
Conflicts: src/day.c src/recur.c
2012-11-23Release screen mutex if thread diesLukas Fleischer
We did not setup a thread cleanup procedure which resulted in calcurse freezing if a thread tried to draw on the screen after another thread was canceled while locking the screen. Note that this kind of cleanup handlers should be added to other mutexes as well. This patch just removes the most common case of triggering a deadlock. Also note that we cannot move pthread_cleanup_push() and pthread_cleanup_pop() into the locking/unlocking functions since both pthread_cleanup_push() and pthread_cleanup_pop() may be implemented as macros that must be used in pairs within the same lexical scope. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-11-23Lock screen when drawing on the calendar/notification panelLukas Fleischer
Lock the screen if either the calendar panel or the notification bar is updated to avoid race conditions. Addresses BUG#6. Note that we currently always use a screen-level lock, even if only one window is affected. This is to be changed in the future. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-11-23Do not display a mark when files are auto-savedLukas Fleischer
This is kind of useless since users are not able to react to an auto-save notification. It also causes all kinds of problems if the status bar is in a non-standard mode (message, prompt, ...) and is prone to race conditions if the status bar is updated by another thread at the same time. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-11-22Replace localtime() with localtime_r()Lukas Fleischer
Since the result of localtime() is stored in a statically allocated structure, data was overwritten when a context switch occurred during (or shortly after) the execution of localtime(), potentially resulting in critical data corruption. BUG#7 and BUG#8 are likely related. This patch converts all usages of localtime() with localtime_r(), which is thread-safe. Reported-by: Baptiste Jonglez <baptiste@jonglez.org> Reported-by: Erik Saule <esaule@bmi.osu.edu> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-11-18Use status_ask_choice() for the export dialogLukas Fleischer
Remove the export bar and use a simple status_ask_choice() dialog instead. This reduces code complexity and replaces another unnecessary menu by the well-tested dialog feature that is used everywhere else. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-11-18Remove unused parameter from key handlersLukas Fleischer
This is no longer needed since different keys use different handlers now. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-11-18calcurse.c: Pull out key_move_*()Lukas Fleischer
Supersedes the "key" parameter from following functions: * key_generic_prev_day() * key_generic_next_day() * key_generic_prev_week() * key_generic_next_week() Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-11-18calcurse.c: Break up key_change_priority()Lukas Fleischer
Split up key_change_priority() into key_raise_priority(), key_lower_priority() which are wrappers around a new convenience function change_priority(). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-11-18calcurse.c: Pull out key_generic_goto_today()Lukas Fleischer
Split out key_generic_goto_today() into a separate function. This simplifies the control flow and supersedes the "key" parameter in key_generic_goto(). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-11-18Refactor todo_chg_priority()Lukas Fleischer
Instead of passing a key, pass the number of steps to increase the priority by. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-11-18calcurse.c: Refactor the main loopLukas Fleischer
Break up the big switch statement into several functions. The functions are declared inline to avoid unnecessary function calls. Also: * Add a "KEY_HANDLER" macro can be used as a short version of a "case" statement, followed by a function call. * Declare several state variables global to avoid having to pass them to each of the new handlers. * Pass the pressed key to each of the handler functions in order not to break handlers that handled more than one key before the handlers were pulled out. These three changes were introduced to keep this patch as atomic as possible and are intended to be removed in following patches. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-11-18Add support for entering times in 24 hour formatWilliam Pettersson
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-07-10Use integers rather than floats everywhereLukas Fleischer
We don't need floating point precision if results are casted back to integer. Instead, rearrange operations and do the integer division after the multiplication. Version numbers are terminating decimals anyway and can be stored using two integers without losing any information. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-07-07Add new default key binding for generic-pasteLukas Fleischer
Use "p" as an additional (vim-style) default binding for generic-paste. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-07-07Remove the erase flag and legacy deletion codeLukas Fleischer
This is no longer needed. Note removal, as well as exception handling, have been moved to separate functions and the cut feature has been merged into the deletion function. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-07-07Merge cut/deleteLukas Fleischer
Remove the cut function and merge it into the del-item command. This allows for vim-style cutting/pasting. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-07-07Refactor exception handlingLukas Fleischer
Remove the exception handling code from recur_*_erase() and move it to separate functions recur_*_add_exc(). Create a wrapper function day_item_add_exc() that can be used to add an exception to generic items. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-07-07Refactor note removalLukas Fleischer
Remove the note removal code from *_delete()/*_erase() and create a new wrapper function called day_item_erase_note() that is be used to drop the note being associated to an item. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-07-07Add support for copy/paste registersLukas Fleischer
This adds support for vim-style copy/paste registers which allows cutting and copying multiple items without having to overwrite the copy/paste buffer. Registers can be specified using the quote key ('"'). To access a register, type '"x' before a command where "x" is the name of a register. If you want to copy the currently selected item into register 1, type '"1c'. Valid registers are 0-9, a-z, "-" and "_". Note that the latter is the so-called black hole register, which works similar to the black hole register in vim. The register prefix key is currently hardcoded and cannot be configured. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-07-06Add a key binding for generic-copyLukas Fleischer
This finally adds full copy-paste support. Implements FR#15. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-07-06Add interact_day_item_copy()Lukas Fleischer
This can be used to copy an item, so that it can be pasted somewhere else later. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-07-06Do not bind "c" to "generic-config-menu" by defaultLukas Fleischer
The "c" key will be used for the generic-copy command in the future. The configuration menu isn't needed a lot, so binding it to "C" only seems legit. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-07-06Duplicate items when pastingLukas Fleischer
This allows pasting items more than once. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-07-06Add day_item_fork()Lukas Fleischer
Add a new function that can be used to copy one day item into another, cloning the actual item that is linked. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-07-06Refactor *_dup()Lukas Fleischer
* Actually duplicate an item instead of copying data only. * Properly clone an item without a note. * Mark *_dup() public. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>