aboutsummaryrefslogtreecommitdiff
path: root/utf8.h
Commit message (Collapse)AuthorAge
* strbuf: add fixed-length version of add_wrapped_textJeff King2011-02-23
| | | | | | | | | | | | | | | | | The function strbuf_add_wrapped_text takes a NUL-terminated string. This makes it annoying to wrap strings we have as a pointer and a length. Refactoring strbuf_add_wrapped_text and all of its sub-functions to handle fixed-length strings turned out to be really ugly. So this implementation is lame; it just strdups the text and operates on the NUL-terminated version. This should be fine as the strings we are wrapping are generally pretty short. If it becomes a problem, we can optimize later. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'rs/optim-text-wrap'Junio C Hamano2010-03-02
|\ | | | | | | | | | | | | | | * rs/optim-text-wrap: utf8.c: speculatively assume utf-8 in strbuf_add_wrapped_text() utf8.c: remove strbuf_write() utf8.c: remove print_spaces() utf8.c: remove print_wrapped_text()
| * utf8.c: remove print_wrapped_text()René Scharfe2010-02-20
| | | | | | | | | | | | | | | | | | | | | | strbuf_add_wrapped_text() is called only from print_wrapped_text() without a strbuf (in which case it writes its results to stdout). At its only callsite, supply a strbuf, call strbuf_add_wrapped_text() directly and remove the wrapper function. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | utf8.c: mark file-local function staticJunio C Hamano2010-01-12
|/ | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Add strbuf_add_wrapped_text() to utf8.[ch]Johannes Schindelin2009-10-19
| | | | | | | 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>
* utf8: add utf8_strwidth()Geoffrey Thomas2009-02-04
| | | | | | | 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>
* utf8_width(): allow non NUL-terminated inputJunio C Hamano2008-01-06
| | | | | | | 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>
* utf8: pick_one_utf8_char()Junio C Hamano2008-01-06
| | | | | | | | | 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>
* Actually make print_wrapped_text() usefulJohannes Schindelin2007-02-27
| | | | | | | | | | | 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>
* commit-tree: cope with different ways "utf-8" can be spelled.Junio C Hamano2006-12-30
| | | | | | | | 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>
* Move encoding conversion routine out of mailinfo to utf8.cJunio C Hamano2006-12-26
| | | | | | | 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>
* commit-tree: encourage UTF-8 commit messages.Johannes Schindelin2006-12-24
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>