summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a7fe625)
raw | patch | inline | side by side (parent: a7fe625)
author | Jonas Fonseca <fonseca@diku.dk> | |
Wed, 24 Mar 2010 12:35:13 +0000 (08:35 -0400) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Mon, 29 Mar 2010 00:18:16 +0000 (20:18 -0400) |
tig.c | patch | blob | history |
index 1eb482aac4a8fbbcfbcd5e4b7ea80e884299a23a..d2220c2e1ded37e067d3c6f1c4b04b7b1d82afef 100644 (file)
--- a/tig.c
+++ b/tig.c
static void warn(const char *msg, ...);
static void report(const char *msg, ...);
static void set_nonblocking_input(bool loading);
-static size_t utf8_length(const char **string, size_t col, int *width, size_t max_width, int *trimmed, bool reserve);
+static size_t utf8_length(const char **start, size_t skip, int *width, size_t max_width, int *trimmed, bool reserve, int tab_size);
static inline unsigned char utf8_char_length(const char *string, const char *end);
#define ABS(x) ((x) >= 0 ? (x) : -(x))
if (max_len <= 0)
return 0;
- len = utf8_length(&string, skip, &col, max_len, &trimmed, use_tilde);
+ len = utf8_length(&string, skip, &col, max_len, &trimmed, use_tilde, opt_tab_size);
set_view_attr(view, type);
if (len > 0) {
*/
static inline int
-unicode_width(unsigned long c)
+unicode_width(unsigned long c, int tab_size)
{
if (c >= 0x1100 &&
(c <= 0x115f /* Hangul Jamo */
return 2;
if (c == '\t')
- return opt_tab_size;
+ return tab_size;
return 1;
}
*
* Returns the number of bytes to output from string to satisfy max_width. */
static size_t
-utf8_length(const char **start, size_t skip, int *width, size_t max_width, int *trimmed, bool reserve)
+utf8_length(const char **start, size_t skip, int *width, size_t max_width, int *trimmed, bool reserve, int tab_size)
{
const char *string = *start;
const char *end = strchr(string, '\0');
@@ -6882,7 +6882,7 @@ utf8_length(const char **start, size_t skip, int *width, size_t max_width, int *
if (!unicode)
break;
- ucwidth = unicode_width(unicode);
+ ucwidth = unicode_width(unicode, tab_size);
if (skip > 0) {
skip -= ucwidth <= skip ? ucwidth : skip;
*start += bytes;