Commit Graph

9 Commits

Author SHA1 Message Date
Junio C Hamano
5e133b8cf9 utf8.c: mark file-local function static
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-12 01:06:09 -08:00
Johannes Schindelin
a94410c813 Add strbuf_add_wrapped_text() to utf8.[ch]
The newly added function can rewrap text according to a given first-line
indent, other-indent and text width.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2009-10-19 00:57:29 -07:00
Geoffrey Thomas
8a9391e944 utf8: add utf8_strwidth()
I'm about to use this pattern more than once, so make it a common function.

Signed-off-by: Geoffrey Thomas <geofft@mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-04 16:30:43 -08:00
Junio C Hamano
44b25b872f utf8_width(): allow non NUL-terminated input
The original interface assumed that the input string is
always terminated with a NUL, but that wasn't too useful.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-01-06 20:53:46 -08:00
Junio C Hamano
396ccf1fcb utf8: pick_one_utf8_char()
utf8_width() function was doing two different things.  To pick a
valid character from UTF-8 stream, and compute the display width of
that character.  This splits the former to a separate function
pick_one_utf8_char().

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-01-06 20:27:35 -08:00
Johannes Schindelin
094e03b039 Actually make print_wrapped_text() useful
Now, it returns the current column, does not add a newline, and you can
pass a negative indent, to indicate that the indent was already printed.

With this, you can actually continue in the middle of a paragraph, not
having to print everything into a buffer first.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-27 17:29:02 -08:00
Junio C Hamano
677cfed56a commit-tree: cope with different ways "utf-8" can be spelled.
People can spell config.commitencoding differently from what we
internally have ("utf-8") to mean UTF-8.  Try to accept them and
treat them equally.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-30 15:58:43 -08:00
Junio C Hamano
b45974a655 Move encoding conversion routine out of mailinfo to utf8.c
This moves the body of convert_to_utf8() routine used in mailinfo
to the utf8.c i18n library.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-26 00:22:39 -08:00
Johannes Schindelin
9e83266525 commit-tree: encourage UTF-8 commit messages.
Introduce is_utf() to check if a text looks like it is encoded
in UTF-8, utf8_width() to count display width, and implements
print_wrapped_text() using them.

git-commit-tree warns if the commit message does not minimally
conform to the UTF-8 encoding when i18n.commitencoding is either
unset, or set to "utf-8".

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-24 00:32:49 -08:00