diff options
author | Vanilla I. Shu <vanilla@FreeBSD.org> | 2002-03-03 03:38:30 +0000 |
---|---|---|
committer | Vanilla I. Shu <vanilla@FreeBSD.org> | 2002-03-03 03:38:30 +0000 |
commit | 232caa5fd109346a642f835a577de360794b8e61 (patch) | |
tree | a62afa5fc0f54b3edac0acb256d526e4f1f8f8a8 /chinese/irssi | |
parent | Add wots 1.22, system log watch/alert utility, similar to swatch, (diff) |
Upgrade to irssi-0.8.1,
Add line-wrap support with big5 charset.
Add multibytes cursor movement support with big5 charset.
PR: ports/35485
Submitted by: Chou Yeh-Jyi <yjchou@cis.nctu.edu.tw>
Notes
Notes:
svn path=/head/; revision=55440
Diffstat (limited to 'chinese/irssi')
-rw-r--r-- | chinese/irssi/Makefile | 14 | ||||
-rw-r--r-- | chinese/irssi/files/patch-config | 60 | ||||
-rw-r--r-- | chinese/irssi/files/patch-config.h.in | 10 | ||||
-rw-r--r-- | chinese/irssi/files/patch-configure.in | 37 | ||||
-rw-r--r-- | chinese/irssi/files/patch-irssi.conf | 83 | ||||
-rw-r--r-- | chinese/irssi/files/patch-src::fe-text::gui-entry.c | 85 | ||||
-rw-r--r-- | chinese/irssi/files/patch-src::fe-text::term-terminfo.c | 15 | ||||
-rw-r--r-- | chinese/irssi/files/patch-src::fe-text::textbuffer-view.c | 45 | ||||
-rw-r--r-- | chinese/irssi/files/patch-src::fe-text::utf8.h | 14 | ||||
-rw-r--r-- | chinese/irssi/files/patch-src_fe-text_gui-entry.c | 87 | ||||
-rw-r--r-- | chinese/irssi/files/patch-src_fe-text_screen.h | 24 | ||||
-rw-r--r-- | chinese/irssi/files/patch-src_fe-text_window.c | 65 |
12 files changed, 247 insertions, 292 deletions
diff --git a/chinese/irssi/Makefile b/chinese/irssi/Makefile index 09cadedd8a75..92552699249b 100644 --- a/chinese/irssi/Makefile +++ b/chinese/irssi/Makefile @@ -6,21 +6,17 @@ # MASTERDIR= ${.CURDIR}/../../irc/irssi -EXTRA_PATCHES= ${.CURDIR}/files/patch-config.h.in \ - ${.CURDIR}/files/patch-configure.in \ - ${.CURDIR}/files/patch-src_fe-text_gui-entry.c \ - ${.CURDIR}/files/patch-src_fe-text_screen.h \ - ${.CURDIR}/files/patch-src_fe-text_window.c +EXTRA_PATCHES= ${.CURDIR}/files/patch-irssi.conf \ + ${.CURDIR}/files/patch-src::fe-text::gui-entry.c \ + ${.CURDIR}/files/patch-src::fe-text::term-terminfo.c \ + ${.CURDIR}/files/patch-src::fe-text::textbuffer-view.c \ + ${.CURDIR}/files/patch-src::fe-text::utf8.h PORTREVISION= 0 CATEGORIES= chinese MAINTAINER= vanilla@FreeBSD.org -BROKEN= patches are not compatible for 0.8.1 -USE_AUTOCONF= yes -CONFIGURE_ARGS+= --with-big5 - .include "${MASTERDIR}/Makefile" PKGNAMEPREFIX:= ${PKGNAMEPREFIX}tw- diff --git a/chinese/irssi/files/patch-config b/chinese/irssi/files/patch-config deleted file mode 100644 index 4d304f2c7dd3..000000000000 --- a/chinese/irssi/files/patch-config +++ /dev/null @@ -1,60 +0,0 @@ ---- config.orig Sat Apr 28 02:59:56 2001 -+++ config Sat Apr 28 03:04:54 2001 -@@ -1,27 +1,15 @@ - servers = ( -- { address = "irc.stealth.net"; chatnet = IRCNet; port = 6668; }, -- { address = "irc.efnet.net"; chatnet = EFNet; port = 6667; }, -- { address = "irc.undernet.org"; chatnet = Undernet; port = 6667; }, -- { address = "irc.dal.net"; chatnet = DALNet; port = 6667; }, -- { address = "irc.openprojects.net"; chatnet = OPN; port = 6667; }, -- { address = "irc.ptlink.net"; chatnet = PTlink; port = 6667; } -- { address = "silc.pspt.fi"; chatnet = SILC; port = 706; } -+ { address = "irc.hinet.net"; chatnet = Hinet; port = 6667; }, -+ { address = "irc.seed.net.tw"; chatnet = Seednet; port = 6667; } - ); - - chatnets = { -- IRCNet = { type = "IRC"; max_kicks = 4; max_modes = 3; max_msgs = 5; max_whois = 4; }; -- EFNet = { type = "IRC"; max_kicks = 4; max_modes = 4; max_msgs = 3; }; -- Undernet = { type = "IRC"; max_kicks = 4; max_modes = 3; max_msgs = 3; max_query_chans = "1"; }; -- DALNet = { type = "IRC"; max_kicks = 4; max_modes = 6; max_msgs = 3; }; -- OPN = { type = "IRC"; max_kicks = 1; max_modes = 6; max_msgs = 100; }; -- PTLink = { type = "IRC"; max_kicks = 1; max_modes = 6; max_msgs = 100; }; -- SILC = { type = "SILC"; }; -+ Hinet = { type = "IRC"; max_kicks = 3; max_modes = 3; max_msgs = 3; }; -+ Seednet = { type = "IRC"; }; - }; - - channels = ( -- { name = "#irssi"; chatnet = ircnet; autojoin = No; }, -- { name = "#irssi"; chatnet = opn; autojoin = No; }, -- { name = "#silc"; chatnet = silc; autojoin = No; } -+ { name = "#bsdchat"; chatnet = Seednet; autojoin = No; } - ); - - aliases = { -@@ -61,4 +49,24 @@ - WN = "window new hide"; - SV = "say Irssi $J - http://irssi.org"; - GOTO = "sb goto"; -+}; -+settings = { -+ "fe-common/core" = { -+ use_status_window = "yes"; -+ use_msgs_window = "yes"; -+ reuse_unused_windows = "yes"; -+ autocreate_windows = "yes"; -+ autolog = "yes"; -+ autolog_path = "~/.irssi/logs/%Y/$m/%d/$tag.$0"; -+ timestamps = "no"; -+ hide_text_style = "yes"; -+ autolog_level = "all"; -+ autocreate_query_level = "msgs"; -+ autocreate_own_query = "no"; -+ window_auto_change = "no"; -+ }; -+ "irc/dcc" = { -+ dcc_download_path = "~/.irssi/download"; -+ dcc_autoget = "yes"; -+ }; - }; diff --git a/chinese/irssi/files/patch-config.h.in b/chinese/irssi/files/patch-config.h.in deleted file mode 100644 index e7c1b067624d..000000000000 --- a/chinese/irssi/files/patch-config.h.in +++ /dev/null @@ -1,10 +0,0 @@ ---- config.h.in.orig Fri Mar 9 09:28:46 2001 -+++ config.h.in Fri Apr 27 22:36:31 2001 -@@ -45,6 +45,7 @@ - - /* misc.. */ - #undef MEM_DEBUG -+#undef WANT_BIG5 - #undef HAVE_IPV6 - #undef HAVE_POPT_H - #undef HAVE_SOCKS_H diff --git a/chinese/irssi/files/patch-configure.in b/chinese/irssi/files/patch-configure.in deleted file mode 100644 index 0fd3ab39a540..000000000000 --- a/chinese/irssi/files/patch-configure.in +++ /dev/null @@ -1,37 +0,0 @@ ---- configure.in.orig Tue Mar 13 23:52:32 2001 -+++ configure.in Sat Apr 28 00:48:10 2001 -@@ -37,6 +37,19 @@ - # check posix headers.. - AC_CHECK_HEADERS(sys/time.h sys/utsname.h regex.h) - -+AC_ARG_WITH(big5, -+[ --with-big5 Build with tr-Chinese Big5 support], -+ if test x$withval = xyes; then -+ want_big5=yes -+ else -+ if test "x$withval" = xno; then -+ want_big5=no -+ else -+ want_big5=yes -+ fi -+ fi, -+ want_big5=no) -+ - AC_ARG_WITH(socks, - [ --with-socks Build with socks support], - if test x$withval = xyes; then -@@ -687,6 +700,14 @@ - AC_DEFINE(MEM_DEBUG) - fi - AM_CONDITIONAL(BUILD_MEMDEBUG, test "x$want_memdebug" = "xyes") -+ -+dnl ** -+dnl ** tr-Chinese Big5 support -+dnl ** -+ -+if test "x$want_big5" = "xyes"; then -+ AC_DEFINE(WANT_BIG5) -+fi - - dnl ** - dnl ** IPv6 support diff --git a/chinese/irssi/files/patch-irssi.conf b/chinese/irssi/files/patch-irssi.conf new file mode 100644 index 000000000000..2db304df5b7b --- /dev/null +++ b/chinese/irssi/files/patch-irssi.conf @@ -0,0 +1,83 @@ +--- irssi.conf.orig Sun Mar 3 10:21:54 2002 ++++ irssi.conf Sun Mar 3 10:26:51 2002 +@@ -1,65 +1,17 @@ + servers = ( +- { address = "irc.stealth.net"; chatnet = "IRCNet"; port = "6668"; }, +- { address = "irc.efnet.net"; chatnet = "EFNet"; port = "6667"; }, +- { +- address = "irc.undernet.org"; +- chatnet = "Undernet"; +- port = "6667"; +- }, +- { address = "irc.dal.net"; chatnet = "DALnet"; port = "6667"; }, +- { address = "irc.openprojects.net"; chatnet = "OPN"; port = "6667"; }, +- { address = "irc.gnome.org"; chatnet = "GIMPNet"; port = "6667"; }, +- { address = "irc.ptlink.net"; chatnet = "PTlink"; port = "6667"; }, +- { address = "silc.pspt.fi"; chatnet = "SILC"; port = "706"; } ++ { address = "irc.hinet.net"; charnet = "Hinet"; port = "6667"; }, ++ { address = "irc.seed.net.tw"; chatnet = "BSDChat"; port = "6667"; }, ++ { address = "irc.csie.nctu.edu.tw"; chatnet = "BSDChat"; port = "6667"; }, ++ { address = "irc.tw.freebsd.org"; chatnet = "BSDChat"; port = "6667"; } + ); + + chatnets = { +- IRCNet = { +- type = "IRC"; +- max_kicks = "4"; +- max_modes = "3"; +- max_msgs = "5"; +- max_whois = "4"; +- max_query_chans = "5"; +- }; +- EFNet = { +- type = "IRC"; +- max_kicks = "4"; +- max_modes = "4"; +- max_msgs = "3"; +- }; +- Undernet = { +- type = "IRC"; +- max_kicks = "4"; +- max_modes = "3"; +- max_msgs = "3"; +- }; +- DALNet = { +- type = "IRC"; +- max_kicks = "4"; +- max_modes = "6"; +- max_msgs = "3"; +- }; +- OPN = { type = "IRC"; max_kicks = "4"; max_modes = "4"; max_msgs = "1"; }; +- GIMPNet = { +- type = "IRC"; +- max_kicks = "4"; +- max_modes = "4"; +- max_msgs = "3"; +- }; +- PTLink = { +- type = "IRC"; +- max_kicks = "1"; +- max_modes = "6"; +- max_msgs = "100"; +- }; +- SILC = { type = "SILC"; }; ++ Hinet = { type = "IRC"; max_kicks = "3"; max_modes = "3"; max_msgs = "3"; }; ++ BSDChat = { type = "IRC"; max_kicks = 4; max_modes = 6; max_msgs = 3; }; + }; + + channels = ( +- { name = "#irssi"; chatnet = "ircnet"; autojoin = "No"; }, +- { name = "#irssi"; chatnet = "opn"; autojoin = "No"; }, +- { name = "#silc"; chatnet = "silc"; autojoin = "No"; } ++ { name = "#bsdchat"; chatnet = "BSDChat"; autojoin = "No"; }, + ); + + aliases = { +@@ -192,6 +144,7 @@ + position = "1"; + visible = "always"; + items = { info = { }; }; ++ disabled = "yes"; + }; + + # we treat input line as yet another statusbar :) It's possible to diff --git a/chinese/irssi/files/patch-src::fe-text::gui-entry.c b/chinese/irssi/files/patch-src::fe-text::gui-entry.c new file mode 100644 index 000000000000..f40254b53bd4 --- /dev/null +++ b/chinese/irssi/files/patch-src::fe-text::gui-entry.c @@ -0,0 +1,85 @@ +--- src/fe-text/gui-entry.c.orig Sat Feb 16 19:10:11 2002 ++++ src/fe-text/gui-entry.c Sun Mar 3 10:29:10 2002 +@@ -67,6 +69,27 @@ + g_free(entry); + } + ++/* Fixes the cursor position if it at big5_lo . ++ Direct: -1 , left shift 1 byte. ++ Direct: 0, +1 , right shift 1 byte. ++*/ ++static int _fix_big5_pos(unichar *p, int pos, int direct) ++{ ++ int newpos; ++ ++ for (newpos=0; newpos<pos && p[newpos] != 0; ) { ++ if (is_big5(p[newpos], p[newpos+1])) ++ newpos += 2; ++ else ++ newpos ++; ++ } ++ ++ if (newpos != pos) ++ pos += direct > 0 ? 1 : -1; ++ ++ return pos; ++} ++ + /* Fixes the cursor position in screen */ + static void gui_entry_fix_cursor(GUI_ENTRY_REC *entry) + { +@@ -84,6 +107,8 @@ + entry->scrstart = entry->pos - entry->scrpos; + } + ++ entry->scrstart = _fix_big5_pos(entry->text, entry->scrstart, -1); ++ + if (old_scrstart != entry->scrstart) + entry->redraw_needed_from = 0; + } +@@ -335,11 +360,18 @@ + + void gui_entry_erase(GUI_ENTRY_REC *entry, int size) + { ++ int newpos; ++ + g_return_if_fail(entry != NULL); + + if (entry->pos < size) + return; + ++ /* recount the erase size with big5 charsets */ ++ for (newpos = entry->pos; newpos >= 0 && size > 0; size--) ++ newpos = _fix_big5_pos(entry->text, newpos-1, -1); ++ size = entry->pos - newpos; ++ + /* put erased text to cutbuffer */ + if (entry->cutbuffer == NULL || entry->cutbuffer_len < size) { + g_free(entry->cutbuffer); +@@ -461,10 +493,24 @@ + + void gui_entry_move_pos(GUI_ENTRY_REC *entry, int pos) + { ++ int newpos; ++ + g_return_if_fail(entry != NULL); + +- if (entry->pos+pos >= 0 && entry->pos+pos <= entry->text_len) +- entry->pos += pos; ++ /* move cursor with big5 charset */ ++ newpos = _fix_big5_pos(entry->text, entry->pos, -1); ++ if (pos > 0) { ++ while (pos > 0 && newpos < entry->text_len) { ++ newpos = _fix_big5_pos(entry->text, newpos+1, 1); ++ pos --; ++ } ++ } else { ++ while (pos < 0 && newpos > 0) { ++ newpos = _fix_big5_pos(entry->text, newpos-1, -1); ++ pos ++; ++ } ++ } ++ entry->pos = newpos; + + gui_entry_fix_cursor(entry); + gui_entry_draw(entry); diff --git a/chinese/irssi/files/patch-src::fe-text::term-terminfo.c b/chinese/irssi/files/patch-src::fe-text::term-terminfo.c new file mode 100644 index 000000000000..485beb0f848a --- /dev/null +++ b/chinese/irssi/files/patch-src::fe-text::term-terminfo.c @@ -0,0 +1,15 @@ +--- src/fe-text/term-terminfo.c.orig Sun Feb 17 23:48:32 2002 ++++ src/fe-text/term-terminfo.c Sun Mar 3 10:10:42 2002 +@@ -549,12 +549,6 @@ + } + } + +-/* XXX I didn't check the encoding range of big5+. This is standard big5. */ +-#define is_big5_los(lo) (0x40 <= (lo) && (lo) <= 0x7E) /* standard */ +-#define is_big5_lox(lo) (0x80 <= (lo) && (lo) <= 0xFE) /* extended */ +-#define is_big5_hi(hi) (0x81 <= (hi) && (hi) <= 0xFE) +-#define is_big5(hi,lo) (is_big5_hi(hi) && (is_big5_los(lo) || is_big5_lox(lo))) +- + static int input_big5(const unsigned char *buffer, int size, unichar *result) + { + if (is_big5_hi(*buffer)) { diff --git a/chinese/irssi/files/patch-src::fe-text::textbuffer-view.c b/chinese/irssi/files/patch-src::fe-text::textbuffer-view.c new file mode 100644 index 000000000000..4221fe58c76f --- /dev/null +++ b/chinese/irssi/files/patch-src::fe-text::textbuffer-view.c @@ -0,0 +1,45 @@ +--- src/fe-text/textbuffer-view.c.orig Fri Feb 15 22:10:10 2002 ++++ src/fe-text/textbuffer-view.c Sun Mar 3 10:10:42 2002 +@@ -194,7 +194,7 @@ + continue; + } + +- if (xpos == view->width && sub != NULL && ++ if (xpos >= view->width && sub != NULL && + (last_space <= indent_pos || last_space <= 10) && + view->longword_noindent) { + /* long word, remove the indentation from this line */ +@@ -202,7 +202,7 @@ + sub->indent = 0; + } + +- if (xpos == view->width) { ++ if (xpos >= view->width) { + xpos = indent_func == NULL ? indent_pos : + indent_func(view, line, -1); + +@@ -233,12 +233,21 @@ + if (view->utf8) + get_utf8_char(&ptr, 6); + +- xpos++; +- if (*ptr++ == ' ') { ++ /* set line-wrap data with big5 charset */ ++ xpos ++; ++ if (ptr[1] != '\0' && is_big5(ptr[0], ptr[1])) { + last_space = xpos-1; ++ xpos ++; ++ if (xpos < view->width) ++ ptr += 2; + last_space_ptr = ptr; + last_color = color; +- } ++ } else if (*ptr == ' ') { ++ last_space = xpos-1; ++ last_space_ptr = ++ptr; ++ last_color = color; ++ } else ++ ptr++; + } + + rec = g_malloc(sizeof(LINE_CACHE_REC)-sizeof(LINE_CACHE_SUB_REC) + diff --git a/chinese/irssi/files/patch-src::fe-text::utf8.h b/chinese/irssi/files/patch-src::fe-text::utf8.h new file mode 100644 index 000000000000..63d6f6d11aae --- /dev/null +++ b/chinese/irssi/files/patch-src::fe-text::utf8.h @@ -0,0 +1,14 @@ +--- src/fe-text/utf8.h.orig Sun Feb 17 23:10:09 2002 ++++ src/fe-text/utf8.h Sun Mar 3 10:10:42 2002 +@@ -18,4 +18,11 @@ + Make sure out is at least 6 x length of str. */ + void utf16_to_utf8(const unichar *str, char *out); + ++/* XXX I didn't check the encoding range of big5+. This is standard big5. */ ++#define is_big5_los(lo) (0x40 <= (lo) && (lo) <= 0x7E) /* standard */ ++#define is_big5_lox(lo) (0x80 <= (lo) && (lo) <= 0xFE) /* extended */ ++#define is_big5_lo(lo) ((is_big5_los(lo) || is_big5_lox(lo))) ++#define is_big5_hi(hi) (0x81 <= (hi) && (hi) <= 0xFE) ++#define is_big5(hi,lo) (is_big5_hi(hi) && is_big5_lo(lo)) ++ + #endif diff --git a/chinese/irssi/files/patch-src_fe-text_gui-entry.c b/chinese/irssi/files/patch-src_fe-text_gui-entry.c deleted file mode 100644 index a621af8e6e6b..000000000000 --- a/chinese/irssi/files/patch-src_fe-text_gui-entry.c +++ /dev/null @@ -1,87 +0,0 @@ ---- src/fe-text/gui-entry.c.orig Sun Mar 4 02:04:10 2001 -+++ src/fe-text/gui-entry.c Sat Jan 26 20:38:19 2002 -@@ -29,6 +29,28 @@ - static int prompt_hidden; - static char *prompt; - -+#ifdef WANT_BIG5 -+#include "settings.h" -+ -+int gui_is_big5(char *str, int pos) -+{ -+ int a; -+ -+ if(pos < 0) -+ return 0; -+ for(a = 0; a < pos;) -+ { -+ if(str[0] == '\0') -+ break; -+ if(is_big5(str[a], str[a + 1])) -+ a += 2; -+ else -+ a ++; -+ } -+ return ((a == pos) && is_big5(str[a], str[a + 1])); -+} -+#endif WANT_BIG5 -+ - static void entry_screenpos(void) - { - if (pos-scrstart < COLS-2-promptlen && pos-scrstart > 0) { -@@ -42,6 +64,14 @@ - } else { - scrpos = (COLS-promptlen)*2/3; - scrstart = pos-scrpos; -+#ifdef WANT_BIG5 -+ if((scrstart > 0) && -+ gui_is_big5(entry->str, scrstart - 1)) -+ { -+ scrstart --; -+ scrpos ++; -+ } -+#endif WANT_BIG5 - } - } - -@@ -152,6 +182,12 @@ - { - if (pos < size) return; - -+#ifdef WANT_BIG5 -+ if (settings_get_bool("big5_cursor_movement")) -+ if(size == 1 && gui_is_big5(entry->str, pos - 2)) -+ size++; -+#endif WANT_BIG5 -+ - pos -= size; - g_string_erase(entry, pos, size); - -@@ -217,6 +253,16 @@ - - void gui_entry_move_pos(int p) - { -+#ifdef WANT_BIG5 -+ if(settings_get_bool("big5_cursor_movement")) -+ { -+ if (p == 1 && gui_is_big5(entry->str, pos)) -+ p++; -+ else if (p == -1 && gui_is_big5(entry->str, pos - 2)) -+ p--; -+ } -+#endif WANT_BIG5 -+ - if (pos+p >= 0 && pos+p <= entry->len) - pos += p; - -@@ -277,6 +323,9 @@ - prompt = NULL; promptlen = 0; - permanent_prompt = FALSE; - prompt_hidden = FALSE; -+#ifdef WANT_BIG5 -+ settings_add_bool("fe-text", "big5_cursor_movement", FALSE); -+#endif WANT_BIG5 - } - - void gui_entry_deinit(void) - diff --git a/chinese/irssi/files/patch-src_fe-text_screen.h b/chinese/irssi/files/patch-src_fe-text_screen.h deleted file mode 100644 index be5b8f9a4831..000000000000 --- a/chinese/irssi/files/patch-src_fe-text_screen.h +++ /dev/null @@ -1,24 +0,0 @@ ---- src/fe-text/screen.h.orig Fri Apr 27 19:13:01 2001 -+++ src/fe-text/screen.h Fri Apr 27 22:38:46 2001 -@@ -16,6 +16,21 @@ - #define ATTR_COLOR8 0x200 - #define ATTR_REVERSE 0x400 - -+/* XXX I hope this could be integrated into BX. -+ * XXX Well, this should be done via libc, -+ * but FreeBSD libc support is quite LAME. -+ * Macro below are copied from lynx. -+ * -+ * clive@FreeBSD.org -+ */ -+#ifdef WANT_BIG5 -+/* XXX I didn't check the encoding range of big5+. This is standard big5. */ -+#define is_big5_los(lo) (((char)0x40<=lo)&&(lo<=(char)0x7E)) /* standard */ -+#define is_big5_lox(lo) (((char)0x80<=lo)&&(lo<=(char)0xFE)) /* extended */ -+#define is_big5_hi(hi) (((char)0x81<=hi)&&(hi<=(char)0xFE)) -+#define is_big5(hi,lo) is_big5_hi(hi) && (is_big5_los(lo) || is_big5_lox(lo)) -+#endif WANT_BIG5 -+ - int init_screen(void); /* Initialize screen, detect screen length */ - void deinit_screen(void); /* Deinitialize screen */ - diff --git a/chinese/irssi/files/patch-src_fe-text_window.c b/chinese/irssi/files/patch-src_fe-text_window.c deleted file mode 100644 index 5e4ec9c6bc97..000000000000 --- a/chinese/irssi/files/patch-src_fe-text_window.c +++ /dev/null @@ -1,65 +0,0 @@ ---- src/fe-text/gui-windows.c.orig Sat Mar 17 07:55:50 2001 -+++ src/fe-text/gui-windows.c Sat Jan 26 19:40:34 2002 -@@ -289,6 +289,7 @@ - unsigned char cmd; - char *ptr, *last_space_ptr; - int xpos, pos, indent_pos, last_space, last_color, color; -+ int w = 0; - - g_return_val_if_fail(line->text != NULL, NULL); - -@@ -343,14 +344,14 @@ - continue; - } - -- if (xpos == COLS && sub != NULL && -+ if (xpos >= COLS && sub != NULL && - (last_space <= indent_pos || last_space <= 10)) { - /* long word, remove the indentation from this line */ - xpos -= sub->indent; - sub->indent = 0; - } - -- if (xpos == COLS) { -+ if (xpos >= COLS) { - xpos = indent_pos; - - sub = g_new(LINE_CACHE_SUB_REC, 1); -@@ -376,8 +377,25 @@ - continue; - } - -- xpos++; -- if (*ptr++ == ' ') { -+ if(ptr[1] != '\0' && is_big5(ptr[0], ptr[1])) -+ w = 2; -+ else -+ w = 1; -+ -+ xpos+=w; -+ if (*ptr == ' ' || -+ (xpos <= COLS && w > 1)) { -+ last_space = xpos-1; -+ last_space_ptr = ptr + w; -+ last_color = color; -+ } -+ if(xpos <= COLS) -+ ptr += w; -+ -+ if(w == 1 && xpos <= COLS && -+ (ptr[0] == ' ' || -+ (ptr[0] != '\0' && ptr[1] != '\0' && is_big5(ptr[0], ptr[1])))) -+ { - last_space = xpos-1; - last_space_ptr = ptr; - last_color = color; -@@ -525,6 +543,9 @@ - next_pos = (n+1 < cache->count) ? - cache->lines[n].start : NULL; - -+ if(next_pos != NULL && next_pos > pos && *(next_pos - 1) == ' ') -+ while(next_pos > pos && *(next_pos - 1) == ' ') -+ next_pos --; - single_line_draw(gui, ypos, sub, pos, next_pos); - } - |