]>
Commit | Line | Data |
---|---|---|
caab3fd1 MB |
1 | diff -urN xchat-gnome-0.24.0/src/fe-gnome/xtext.c xchat-gnome-0.24.0.new/src/fe-gnome/xtext.c |
2 | --- xchat-gnome-0.24.0/src/fe-gnome/xtext.c 2008-09-07 16:18:10.000000000 +0200 | |
3 | +++ xchat-gnome-0.24.0.new/src/fe-gnome/xtext.c 2008-10-12 00:28:44.000000000 +0200 | |
4 | @@ -77,9 +77,16 @@ | |
5 | #endif | |
c0630684 | 6 | |
7 | /* is delimiter */ | |
8 | -#define is_del(c) \ | |
9 | - (c == ' ' || c == '\n' || c == ')' || c == '(' || \ | |
10 | - c == '>' || c == '<' || c == ATTR_RESET || c == ATTR_BOLD || c == 0) | |
12d6f956 | 11 | +static int is_del(const char *c) { |
c0630684 | 12 | + int ret; |
13 | + ret = 0; | |
14 | + ret = (c[0] == ' ' || c[0] == '\n' || c[0] == ')' || c[0] == '(' || | |
15 | + c[0] == '>' || c[0] == '<' || c[0] == ATTR_RESET || c[0] == ATTR_BOLD || c == 0); | |
16 | + if(!ret) { | |
17 | + ret = strncmp(c, "“", 3) == 0 || strncmp(c, "”", 3) == 0; | |
18 | + } | |
19 | + return ret; | |
20 | +} | |
21 | ||
caab3fd1 | 22 | #ifdef SCROLL_HACK |
c0630684 | 23 | /* force scrolling off */ |
caab3fd1 | 24 | @@ -1813,6 +1820,7 @@ |
c0630684 | 25 | int offset; |
26 | unsigned char *str; | |
27 | unsigned char *word; | |
28 | + unsigned char *nstr; | |
29 | int len; | |
30 | int out_of_bounds = 0; | |
31 | ||
caab3fd1 | 32 | @@ -1833,16 +1841,16 @@ |
c0630684 | 33 | |
34 | str = ent->str + offset; | |
35 | ||
caab3fd1 | 36 | - while (!is_del (*str) && str != ent->str) |
c0630684 | 37 | - str--; |
38 | - word = str + 1; | |
caab3fd1 MB |
39 | + while (!is_del(str)) |
40 | + str = g_utf8_prev_char(str); | |
41 | + word = g_utf8_next_char(str); | |
c0630684 | 42 | |
43 | len = 0; | |
44 | str = word; | |
caab3fd1 MB |
45 | - while (!is_del (*str) && len != ent->str_len) |
46 | - { | |
c0630684 | 47 | - str++; |
48 | - len++; | |
caab3fd1 MB |
49 | + while (!is_del(str) && len != ent->str_len) { |
50 | + nstr = g_utf8_next_char(str); | |
51 | + len += nstr - str; | |
52 | + str = nstr; | |
c0630684 | 53 | } |
54 | ||
caab3fd1 MB |
55 | if (len > 0 && word[len-1]=='.') |
56 | @@ -3882,7 +3890,7 @@ | |
c0630684 | 57 | } |
58 | ||
59 | /* keep a record of the last space, for wordwrapping */ | |
caab3fd1 MB |
60 | - if (is_del (*str)) |
61 | + if (g_unichar_isspace(g_utf8_get_char(str))) | |
62 | { | |
c0630684 | 63 | last_space = str; |
64 | limit_offset = 0; |