181 Commits

Author SHA1 Message Date
Lukas Fleischer
e85501e5ef Use constant for maximum UTF-8 character size
Introduce a UTF8_MAXLEN constant instead of using the literal value "6"
at various places.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-07-02 10:09:13 +02:00
Lukas Fleischer
edc20ba443 Split line editing functions into separate file
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>
2011-06-29 15:43:44 +02:00
Lukas Fleischer
271457b7a4 Add basic UTF-8 helper functions
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>
2011-06-29 15:43:44 +02:00
Lukas Fleischer
7f5fc0c62f src/calcurse.h: Add UTF-8 related macros
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-06-29 15:43:44 +02:00
Lukas Fleischer
fec37db06b Avoid redundant redraws on resize
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>
2011-06-28 18:22:43 +02:00
Lukas Fleischer
b2645847a0 Fix whitespace issues
Strip trailing whitespaces in all source files.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-06-09 21:37:22 +02:00
Lukas Fleischer
38865b8e48 Update copyright notices in source files, documentation and "COPYING".
* 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>
2011-04-22 07:26:05 +02:00
Lukas Fleischer
fb5f9d0155 Use generic lists for recurring item exceptions.
Rename "days" structure to "excp" which seems to be a better name here.
Use generic linked lists of excp structures instead of using the "days"
structure which again contains a linked list implementation. Do some
cleanups and invocation fixes.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-22 02:47:36 +02:00
Lukas Fleischer
0ad23c7a8f Remove "next" member from "recur_apoint" structure.
Field seems to be unused. Verify using following spatch:

----
@@ struct recur_apoint *rapt; @@

* rapt->next
----

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-19 11:42:36 +02:00
Lukas Fleischer
9fab24818a Use generic lists for recurring apointments and events.
Use them instead of "recur_apoint_list" and "next" pointers in
"recur_event" type variables. Includes some code simplifications and
cleanups.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-19 11:42:35 +02:00
Lukas Fleischer
2438470fd3 Add recur_apoint_inday() and recur_event_inday().
To be used with llist_fn_match_t callbacks later.

I feel a bit ill adding those functions. This definitely is a hack.
Ultimately, there should be some generic recur_item_inday() function
that accepts both recurring apointments and events (or some wrapper
structure) instead of parameter galeere. This is not the right place to
fix that tho.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-19 11:42:35 +02:00
Lukas Fleischer
153c638d1d Use generic lists for generic day items.
Use the new generic list implementation instead of "next" pointers in
day_item type variables. Includes some cleanups and fixes.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-19 11:42:35 +02:00
Lukas Fleischer
bf431d6cd9 Use generic lists for todo items.
Use the new generic list implementation instead of "next" pointers in
todo items.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-19 11:42:34 +02:00
Lukas Fleischer
6f883c0f3f Use generic lists for events.
Use the new generic list implementation instead of those insane "next"
pointers in events. Includes some cleanups.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-19 11:42:34 +02:00
Lukas Fleischer
1de34587ab Remove "next" member from "apoint" structure.
Field seems to be unused. Verify using following spatch:

----
@@ struct apoint *apt; @@

* apt->next
----

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-19 11:42:34 +02:00
Lukas Fleischer
77ef3fe76e Use generic lists for appointments.
Use the new generic list implementation instead of "apoint_list"
everywhere. Simplify stuff and drop unused variables as well.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-19 11:42:33 +02:00
Lukas Fleischer
d668963e20 Add macros to use for thread-safe linked lists.
Add LLIST_TS_* macros in a fashion similar to the already existing
LLIST_* macros. Unlike the non-thread-safe version, these include
LLIST_TS_LOCK and LLIST_TS_UNLOCK which can be used to lock (and unlock)
a list (hence the thread-safety).

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-19 11:42:33 +02:00
Lukas Fleischer
0eb1da8dd7 Add linked lists implementation.
As discussed on the mailing lists, the various linked list
implementations we currently use at a dozen of different places in the
calcurse source tree are inconvenient and should be replaced by a single
generic solution.

This is a first approach to introduce such a generic implemetation. It
provides following functions:

* llist_init(): Initialize a list.

* llist_free_inner(): Loop through a list and free all items.

* llist_free(): Free the list itself (but not the individual items).

* llist_first(): Get the first item of a list.

* llist_nth(): Get the nth item of a list.

* llist_next(): Get the successor of a list item.

* llist_find_first(): Find an item using a callback function.

* llist_find_next(): Find the next match using a callback function.

* llist_find_nth(): Find the nth item in a list (using a callback).

* llist_get_data(): Get a pointer to the actual data of a list item.

* llist_add(): Add an item at the end of a list.

* llist_add_sorted(): Add an item to a sorted list (using a comparison
                      callback function).

* llist_remove(): Remove an item from a list.

Linked lists are stored in "llist_t" structures, list items are to be
stored in "llist_item_t" structs.

All of the llist_*() functions either expect a pointer to a llist_t
structure (in case the function operates on the list itself) or a
pointer to a llist_item_t (llist_*_next() and llist_get_data()).

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-19 11:42:32 +02:00
Lukas Fleischer
b4a2fa4435 Declare exit_calcurse() "noreturn".
Functions that never return should be declared "noreturn" to tell the
compiler this fact. Also, clang-analyzer will detect this attribute and
take it into account when running scan-build.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-12 12:02:37 +02:00
Lukas Fleischer
b9c1969126 Drop empty notes after editing.
Keeping empty notes doesn't make sense here. Also, there doesn't seem to
be a simple way to erase notes yet. This will make calcurse delete any
notes that are empty (meaning that they are either 0-byte files or
contain nothing but a newline character) when returning from the editor.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-12 12:02:23 +02:00
Lukas Fleischer
c22dcaf6be Update website links to match the new URL.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-04 11:07:49 +01:00
Lukas Fleischer
73e9649387 Update mail addresses to match the new mailing lists.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-04 11:07:40 +01:00
Lukas Fleischer
fdcfd74823 Remove date_sec2hour_str() from "utils.c".
date_sec2hour_str() is superseded by date_sec2date_str() with "%H:%M" as
date format string, so replace all invocations and remove that function
from "utils.c".

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-04 10:08:02 +01:00
Lukas Fleischer
061f74108b Simplify str_toupper() in "utils.c".
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-04 08:54:01 +01:00
Lukas Fleischer
91c9cac898 Remove CVS "$Id" headers.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-03 16:19:45 +01:00
Lukas Fleischer
c8af480f52 Make parse_date accept several short forms.
Short forms are only accepted in interactive mode (e.g. when using the
"Go to" function, editing a recurrent item's end date, and so on).

Samples: "1/1/30" for "01/01/2030", "26" for the 26th of the currently
selected month/year or "3/1" for Mar 01 (or Jan 03, depending on the
date format) of the currently selected year.
2011-01-11 22:10:48 +00:00
Frederic Culot
d220a35771 Compilation issue related to memory functions definition fixed (thanks Doug for reporting it). 2010-03-22 08:16:33 +00:00
Frederic Culot
6892b59622 Avoid concurrent screen refreshes. 2010-03-21 10:17:03 +00:00
Frederic Culot
cc77e839d8 More work on sidebar customization. 2010-03-21 09:21:06 +00:00
Frederic Culot
ec36b96848 Work on sidebar width user-customization. 2010-03-20 13:29:47 +00:00
Frederic Culot
a8cb1c92ef All headers gathered into a single one. Typedefs suppressed. 2010-03-20 10:54:41 +00:00