summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4670cf8)
raw | patch | inline | side by side (parent: 4670cf8)
author | Jonas Fonseca <fonseca@diku.dk> | |
Wed, 24 May 2006 20:58:11 +0000 (22:58 +0200) | ||
committer | Jonas Fonseca <fonseca@antimatter.localdomain> | |
Wed, 24 May 2006 20:58:11 +0000 (22:58 +0200) |
Handling of output encoding still missing.
tig.c | patch | blob | history |
index cdb20aeee5fd6f5d70ebb591c16f26f3d4c6fba0..49c2492f919168e15c96f562b21ae645104814a8 100644 (file)
--- a/tig.c
+++ b/tig.c
static int opt_tab_size = TABSIZE;
static enum request opt_request = REQ_VIEW_MAIN;
static char opt_cmd[SIZEOF_CMD] = "";
-static char opt_encoding[20] = "UTF-8";
+static char opt_encoding[20] = "";
+static bool opt_utf8 = TRUE;
static FILE *opt_pipe = NULL;
/* Returns the index of log or diff command or -1 to exit. */
int col = 0;
size_t timelen;
size_t authorlen;
- int trimmed;
+ int trimmed = 1;
if (!*commit->author)
return FALSE;
if (type != LINE_CURSOR)
wattrset(view->win, get_line_attr(LINE_MAIN_AUTHOR));
- /* FIXME: Make this optional, and add i18n.commitEncoding support. */
- authorlen = utf8_length(commit->author, AUTHOR_COLS - 2, &col, &trimmed);
+ if (opt_utf8) {
+ authorlen = utf8_length(commit->author, AUTHOR_COLS - 2, &col, &trimmed);
+ } else {
+ authorlen = strlen(commit->author);
+ if (authorlen > AUTHOR_COLS - 2) {
+ authorlen = AUTHOR_COLS - 2;
+ trimmed = 1;
+ }
+ }
if (trimmed) {
waddnstr(view->win, commit->author, authorlen);
for (i = 0; i < ARRAY_SIZE(views) && (view = &views[i]); i++)
view->cmd_env = getenv(view->cmd_env);
+ if (*opt_encoding && strcasecmp(opt_encoding, "UTF-8"))
+ opt_utf8 = FALSE;
+
request = opt_request;
init_display();