aboutsummaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
...
* | Rename custom_load_color() to conf_parse_color()Lukas Fleischer2011-07-211-21/+16
| | | | | | | | | | | | | | Also, temporarily remove all error messages and return an error status instead. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Declare foreground and background variables globalLukas Fleischer2011-07-216-12/+15
| | | | | | | | | | | | Removes the need to pass the terminal's default background color round. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Refactor out integer variable parsingLukas Fleischer2011-07-211-6/+26
| | | | | | | | | | | | | | Introduce conf_parse_unsigned() and conf_parse_int() similar to conf_parse_bool(). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Refactor conf_parse_bool()Lukas Fleischer2011-07-212-20/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | * Increase size argument for strncmp() comparisons by one to include the terminating null-character (otherwise "yesfoo" would be parsed as "yes", "nobar" as "no"). * Pass destination address as an additional argument and return success/failure status to allow for better error handling. * Temporarily remove error handling (will be fixed later). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Rename fill_config_var() to conf_parse_bool()Lukas Fleischer2011-07-211-10/+10
| | | | | | | | | | | | | | This is a much better name as it implicitly describes that this function parses boolean configuration values only. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Refactor out configuration variable settingLukas Fleischer2011-07-211-75/+82
| | | | | | | | | | | | | | | | Move configuration variable assignments to a new function, custom_set_conf(). This improves code readability and allows for setting configuration variables outside the configuration file loading function. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Use single-line configuration settings by defaultLukas Fleischer2011-07-151-22/+23
| | | | | | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Parse single-line configuration variablesLukas Fleischer2011-07-151-25/+33
| | | | | | | | | | | | | | Include a fallback branch that accepts multi-line comments as well (backward compatibility). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Be stricter when parsing the configuration fileLukas Fleischer2011-07-151-11/+6
| | | | | | | | | | | | | | | | Throw an error message if there is a line that contains an invalid configuration line (e.g. a non-empty line that neither contains a key nor a value). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Skip indentation and comments in io_extract_data()Lukas Fleischer2011-07-151-1/+2
| | | | | | | | | | | | | | | | We actually only use this function to parse configuration data. Currently, this probably is the best way to do some common preprocessing. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Refactor custom_load_conf()Lukas Fleischer2011-07-151-63/+49
| | | | | | | | | | | | | | | | Read key and value of each configuration setting in one loop cycle to facilitate adjustments of the configuration setting format. Also, this allows us to get rid of all the redundant variable resetting. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Do not unnecessarily refresh in config menuLukas Fleischer2011-07-141-0/+2
| | | | | | | | | | | | | | We don't need to refresh windows every time an unassigned key is pressed. Add a condition to skip the refresh part if that is the case. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Remove artificial delay when saving dataLukas Fleischer2011-07-141-3/+0
| | | | | | | | | | | | | | | | This doesn't contribute to functionality or usability in any way. Keep the progress bar option but only show bars as long as the actual save operation is in progress. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Merge branch 'maint'Lukas Fleischer2011-07-103-2/+20
|\|
| * Honor "TMPDIR" environment variableLukas Fleischer2011-07-093-2/+20
| | | | | | | | | | | | | | | | | | Replace all hardcoded paths referring to "/tmp" with a new function that honors the "TMPDIR" environment variable as well as P_tmpdir and uses "/tmp" as a fallback. Thanks-to: Erik Saule <esaule@bmi.osu.edu> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Add key binding for pipe-item commandLukas Fleischer2011-07-075-7/+33
| | | | | | | | | | | | | | This removes the need of reading the whole data file and find matching entries if we want to parse appointments in external programs. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Add todo_pipe_item() functionLukas Fleischer2011-07-052-0/+30
| | | | | | | | | | | | | | Pipe a serialized todo item to an external process, similar to what day_pipe_item() does (cf. c3f532d814e555abf67efb136491956428f19965). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Add day_pipe_item() functionLukas Fleischer2011-07-052-0/+56
| | | | | | | | | | | | | | | | Serializes an appointment or an event, prompts for a shell command and executes that command in a new process, piping serialized item data to its stdin. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Add press_any_key() functionLukas Fleischer2011-07-052-0/+13
| | | | | | | | | | | | | | Displays "Press any key to continue..." in shell terminal mode and waits for a key stroke. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Move endwin() down in wins_prepare_external()Lukas Fleischer2011-07-051-1/+1
| | | | | | | | | | | | | | | | Invoke endwin() *after* calling any other curses functions, such as refresh(). Calling refresh() after endwin() might restore curses mode which is a bad thing for a terminal mode initialization routine. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Refactor wins_launch_external()Lukas Fleischer2011-07-022-20/+27
| | | | | | | | | | | | | | | | | | * Do window preparation and restoring in separate functions wins_prepare_external() and wins_unprepare_external(). * Use fork_exec() and child_wait() instead of system(). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Add shell_exec() functionLukas Fleischer2011-07-022-0/+9
| | | | | | | | | | | | Can be used to execute an external program in a shell. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Add child_wait() functionLukas Fleischer2011-07-022-0/+17
| | | | | | | | | | | | Can be used to wait for the termination of a child process. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Add fork_exec() functionLukas Fleischer2011-07-022-0/+72
| | | | | | | | | | | | | | Can be used to execute an external program. Provides the possibility to optionally create a pipe to the new process. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Make recur_*_write() publicLukas Fleischer2011-07-022-2/+4
| | | | | | | | | | | | | | This allows one to serialize and send recurrent items to arbitrary output streams. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Refactor out todo item serializationLukas Fleischer2011-07-023-4/+11
| | | | | | | | | | | | | | | | Add a todo_write() function that allows one to serialize todo items and write serialized data to an output stream in a fashion similar to apoint_write() and event_write(). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | utf8_width() performance improvementsLukas Fleischer2011-07-021-39/+50
| | | | | | | | | | | | | | | | | | * Sort character width lookup table by character ranges. * Use binary search instead of linear search for UTF-8 character width lookups which will speed up utf8_width() (O(log n) instead of O(n)). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Avoid segfault in getstr_fixscr()Lukas Fleischer2011-07-021-2/+2
| | | | | | | | | | | | | | | | Avoid a segfault that may occur if getstr_fixscr() changes the scroll offset to something outside the input boundaries (e.g. if a word that is only partly visible is killed via backward-kill-word). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Use constant for maximum UTF-8 character sizeLukas Fleischer2011-07-024-4/+6
| | | | | | | | | | | | | | Introduce a UTF8_MAXLEN constant instead of using the literal value "6" at various places. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Refactor getstring codeLukas Fleischer2011-07-021-53/+65
| | | | | | | | | | | | | | | | | | | | * Rename static showstring() function to getstr_print(), rename ins_char() to getstr_ins_char() and del_char() to getstr_del_char(). * Refactor out getstring data structure initialization and window scrolling routines. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Make display_todo_item() UTF-8 compatibleLukas Fleischer2011-07-021-5/+14
| | | | | | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Make display_item() UTF-8 compatibleLukas Fleischer2011-06-291-6/+15
| | | | | | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Make getstring() UTF-8 compatibleLukas Fleischer2011-06-291-54/+120
| | | | | | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Split line editing functions into separate fileLukas Fleischer2011-06-294-185/+225
| | | | | | | | | | | | | | Move getstring() related stuff into a separate file as a first step on our way to UTF-8 support for line editing helpers. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Add basic UTF-8 helper functionsLukas Fleischer2011-06-293-0/+338
| | | | | | | | | | | | | | | | | | | | Add utf8_width() and utf8_strwidth() which can be used to calculate the display width of a single character or a string, respectively. A lookup table is used to spot double width characters, as well as composing characters. There currently isn't any code to deal with ambigious characters. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | src/calcurse.h: Add UTF-8 related macrosLukas Fleischer2011-06-291-0/+8
| | | | | | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Enable arrow key navigation by defaultLukas Fleischer2011-06-291-4/+4
|/ | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Handle resize properly in the sidebar config menuLukas Fleischer2011-06-291-5/+16
| | | | | | | | | There used to be no resize handler in custom_sidebar_config() which resulted in a messed up screen if the terminal was resized during sidebar configuration. Doing a simple wins_reset() if the terminal was resized works around this problem. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Do not try to display items with negative widthLukas Fleischer2011-06-281-0/+3
| | | | | | | Don't display anything rather than segfault if the appointment panel becomes too small (e.g. during a terminal resize). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Always work with new window dimensions on resizeLukas Fleischer2011-06-281-35/+27
| | | | | | | | | | | | This one came up after improving resizing behaviour in commit fec37db06bbbdff79bc9816046a76e0b29e173b4. We used to use outdated width and height values at various places without noticing it due to the resize algorithm being called several times on every resize. This patch ensures we retrieve the new window dimensions *before* doing any layout calculations. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Avoid redundant redraws on resizeLukas Fleischer2011-06-287-77/+106
| | | | | | | | | | Use a global flag to record whether the terminal was resized instead of redrawing everything each time a KEY_RESIZE is read. Add some additional checks to help_write_pad() as invalid actions may be passed now due to using signals instead of virtual key presses. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/llist.c: Use stable insertion algorithmLukas Fleischer2011-06-201-2/+2
| | | | | | | Ensure the relative order of elements with equal keys is maintained when inserting into a sorted list. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Fix whitespace issuesLukas Fleischer2011-06-095-17/+17
| | | | | | Strip trailing whitespaces in all source files. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/utils.c: Make bell() staticLukas Fleischer2011-06-071-1/+1
| | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Add missing llist header files to "_SOURCES".Lukas Fleischer2011-05-171-0/+2
| | | | | | | | We forgot to add those to the "_SOURCES" variable in commit 0eb1da8dd7fa3ae9d95e12df6058fb41a5ec1c11 and d668963e2056027526374098efe2869a0d389b92. Spotted by `make distcheck`. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Update copyright notices in source files, documentation and "COPYING".Lukas Fleischer2011-04-2224-26/+26
| | | | | | | | | * Update copyright dates (use 2004-2011 as date range everywhere). * Change copyright holder from "Frederic Culot" to "calcurse Development Team". Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Ignore daemon lock file if the daemon process died.Lukas Fleischer2011-04-221-1/+1
| | | | | | | Do this in a fashion similar to what was done in commit 6ff95238766656c5ea9d5c65c35d3aef93499f60. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Return -1 in io_file_is_empty() if file cannot be accessed.Lukas Fleischer2011-04-223-3/+3
| | | | | | | Ensure files don't appear as empty if fopen() fails (e.g. on temporary EACCES failures). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Use "event" structure when iterating over events in app_arg().Lukas Fleischer2011-04-221-1/+1
| | | | | | | Regression introduced in commit 5b174ba5d46c256f41c1cfb952d46f49a088db8a. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Add comments to linked list functions.Lukas Fleischer2011-04-221-0/+39
| | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>