git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] utf8: add utf8_strwidth()

From
Geoffrey Thomas <geofft@mit.edu>
Date
Jan 31, 2009, 08:51 UTC
Message-ID
<alpine.DEB.2.00.0901310348000.3373@vinegar-pot.mit.edu>
In-Reply-To
<20090131071711.GA3710@coredump.intra.peff.net>
On Sat, 31 Jan 2009, Jeff King wrote:
> I know next to nothing about our encoding functions, but this seems
> suspiciously similar to utf8_width in utf8.c. There is also a
> git_wcwidth, but I don't know how they relate.

git_wcwidth determines the screen columns of a single ucs_char_t. utf8_width returns the git_wcwidth of the first character in a string. utf8_strwidth (the function added by this patch) is a simple loop around utf8_width, because writing the loop every time would be silly.

On that note, there are probably more cases in the code that ought to use something like utf8_strwidth. I only noticed this one case because I'm working on a project with someone with an accented letter in his last name.

-- 
Geoffrey Thomas
geofft@mit.edu
Previous: Jeff KingNext: Jeff King
Message 12 of 13 in “utf8: add utf8_strwidth()”
  1. utf8: add utf8_strwidth()Geoffrey Thomas, Jan 30, 2009
  2. builtin-blame.c: Use utf8_strwidth for author's namesGeoffrey Thomas, Jan 30, 2009
  3. Johannes SchindelinJan 30, 2009
  4. Geoffrey ThomasJan 30, 2009
  5. Jeff KingJan 31, 2009
  6. Johannes SchindelinFeb 1, 2009
  7. Junio C HamanoFeb 2, 2009
  8. Johannes SchindelinFeb 2, 2009
  9. Junio C HamanoFeb 3, 2009
  10. Jeff KingFeb 2, 2009
  11. Jeff KingJan 31, 2009
  12. Geoffrey ThomasJan 31, 2009
  13. Jeff KingJan 31, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.