diff options
author | Vanilla I. Shu <vanilla@FreeBSD.org> | 2005-12-12 05:54:32 +0000 |
---|---|---|
committer | Vanilla I. Shu <vanilla@FreeBSD.org> | 2005-12-12 05:54:32 +0000 |
commit | cf5980a2597936f6cf6a8e687c5d77977045b2af (patch) | |
tree | 52a7229af95643d2e2e460c09e544c62bc5cf1c5 /chinese/irssi | |
parent | 01faf1934e9f440dee80aec3f06307e4fd3298b8 (diff) | |
download | ports-cf5980a2597936f6cf6a8e687c5d77977045b2af.tar.gz ports-cf5980a2597936f6cf6a8e687c5d77977045b2af.zip |
Notes
Diffstat (limited to 'chinese/irssi')
-rw-r--r-- | chinese/irssi/Makefile | 12 | ||||
-rw-r--r-- | chinese/irssi/files/patch-irssi.conf | 79 | ||||
-rw-r--r-- | chinese/irssi/files/patch-src::fe-text::gui-entry.c | 355 | ||||
-rw-r--r-- | chinese/irssi/files/patch-src::fe-text::gui-entry.h | 18 | ||||
-rw-r--r-- | chinese/irssi/files/patch-src::fe-text::gui-printtext.c | 11 | ||||
-rw-r--r-- | chinese/irssi/files/patch-src::fe-text::gui-readline.c | 52 | ||||
-rw-r--r-- | chinese/irssi/files/patch-src::fe-text::term-terminfo.c | 44 | ||||
-rw-r--r-- | chinese/irssi/files/patch-src::fe-text::textbuffer-view.c | 18 | ||||
-rw-r--r-- | chinese/irssi/files/patch-src::fe-text::utf8.c | 27 | ||||
-rw-r--r-- | chinese/irssi/files/patch-src::fe-text::utf8.h | 13 |
10 files changed, 10 insertions, 619 deletions
diff --git a/chinese/irssi/Makefile b/chinese/irssi/Makefile index 366db708abe7..c03c038c87a6 100644 --- a/chinese/irssi/Makefile +++ b/chinese/irssi/Makefile @@ -5,7 +5,7 @@ # $FreeBSD$ # -PORTREVISION= 5 +PORTREVISION= 0 CATEGORIES= chinese MAINTAINER= vanilla@FreeBSD.org @@ -13,14 +13,6 @@ COMMENT= A zh-tw cursor movement friendly, wrapping clean irssi MASTERDIR= ${.CURDIR}/../../irc/irssi -EXTRA_PATCHES= ${.CURDIR}/files/patch-irssi.conf \ - ${.CURDIR}/files/patch-src::fe-text::gui-entry.c \ - ${.CURDIR}/files/patch-src::fe-text::gui-entry.h \ - ${.CURDIR}/files/patch-src::fe-text::gui-printtext.c \ - ${.CURDIR}/files/patch-src::fe-text::gui-readline.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.c \ - ${.CURDIR}/files/patch-src::fe-text::utf8.h +EXTRA_PATCHES= ${.CURDIR}/files/patch-irssi.conf .include "${MASTERDIR}/Makefile" diff --git a/chinese/irssi/files/patch-irssi.conf b/chinese/irssi/files/patch-irssi.conf index 05d360fbdc38..26c54c095bf6 100644 --- a/chinese/irssi/files/patch-irssi.conf +++ b/chinese/irssi/files/patch-irssi.conf @@ -1,6 +1,6 @@ ---- irssi.conf.orig Sun Dec 7 16:25:52 2003 -+++ irssi.conf Sun Dec 7 16:29:49 2003 -@@ -1,115 +1,17 @@ +--- irssi.conf.orig Fri Dec 9 01:32:50 2005 ++++ irssi.conf Mon Dec 12 13:50:14 2005 +@@ -1,54 +1,15 @@ servers = ( - { address = "irc.stealth.net"; chatnet = "IRCnet"; port = "6668"; }, - { address = "irc.efnet.net"; chatnet = "EFNet"; port = "6667"; }, @@ -9,24 +9,9 @@ - chatnet = "Undernet"; - port = "6667"; - }, -- { address = "irc.dal.net"; chatnet = "DALnet"; port = "6667"; }, -- { address = "irc.freenode.net"; chatnet = "freenode"; port = "6667"; }, -- { address = "irc.gnome.org"; chatnet = "GIMPNet"; port = "6667"; }, -- { address = "irc.ptlink.net"; chatnet = "PTlink"; port = "6667"; }, -- { -- address = "irc.sorcery.net"; -- chatnet = "SorceryNet"; -- port = "6667"; -- }, -- { -- address = "irc.hashmark.net"; -- chatnet = "Hashmark"; -- port = "6667"; -- }, -- { address = "irc.ptnet.org"; chatnet = "PTnet"; port = "6667"; }, -- { address = "irc.azzurra.org"; chatnet = "AzzurraNET"; port = "6667"; }, +- { address = "irc.dal.net"; chatnet = "DALnet"; port = "6667"; }, +- { address = "irc.quakenet.org"; chatnet = "QuakeNet"; port = "6667"; }, - { address = "silc.silcnet.org"; chatnet = "SILC"; port = "706"; } -+ { address = "irc.hinet.net"; chatnet = "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"; } @@ -36,7 +21,6 @@ - IRCnet = { - type = "IRC"; - max_kicks = "4"; -- max_modes = "3"; - max_msgs = "5"; - max_whois = "4"; - max_query_chans = "5"; @@ -44,80 +28,33 @@ - EFNet = { - type = "IRC"; - max_kicks = "4"; -- max_modes = "4"; - max_msgs = "3"; - max_whois = "1"; - }; - Undernet = { - type = "IRC"; -- max_kicks = "4"; -- max_modes = "3"; +- max_kicks = "1"; - max_msgs = "3"; - max_whois = "30"; - }; - DALnet = { - type = "IRC"; - max_kicks = "4"; -- max_modes = "6"; - max_msgs = "3"; - max_whois = "30"; -- }; -- freenode = { -- type = "IRC"; -- max_kicks = "4"; -- max_modes = "4"; -- max_msgs = "1"; -- max_whois = "1"; -- }; -- GIMPNet = { -- type = "IRC"; -- max_kicks = "4"; -- max_modes = "4"; -- max_msgs = "3"; -- max_whois = "1"; -- }; -- PTlink = { +- }; +- QuakeNet = { - type = "IRC"; - max_kicks = "1"; -- max_modes = "6"; -- max_msgs = "30"; -- max_whois = "1"; -- }; -- SorceryNet = { -- type = "IRC"; -- max_kicks = "30"; -- max_modes = "6"; -- max_msgs = "30"; -- max_whois = "30"; -- }; -- Hashmark = { -- type = "IRC"; -- max_kicks = "4"; -- max_modes = "3"; - max_msgs = "3"; - max_whois = "30"; - }; -- PTnet = { -- type = "IRC"; -- max_kicks = "30"; -- max_modes = "13"; -- max_msgs = "10"; -- max_whois = "30"; -- }; -- AzzurraNET = { -- type = "IRC"; -- max_kicks = "4"; -- max_modes = "6"; -- max_msgs = "3"; -- }; - 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 = "freenode"; autojoin = "No"; }, - { name = "silc"; chatnet = "silc"; autojoin = "No"; } + { name = "#bsdchat"; chatnet = "BSDChat"; autojoin = "No"; } ); 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 a6e7e3254787..000000000000 --- a/chinese/irssi/files/patch-src::fe-text::gui-entry.c +++ /dev/null @@ -1,355 +0,0 @@ ---- src/fe-text/gui-entry.c.orig Sun Oct 26 13:45:02 2003 -+++ src/fe-text/gui-entry.c Thu Apr 29 14:33:53 2004 -@@ -68,28 +68,107 @@ - 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; -- -- if (term_type != TERM_TYPE_BIG5) -- return pos; -- -- for (newpos = 0; newpos < pos && p[newpos] != 0; ) { -- if (is_big5(p[newpos], p[newpos+1])) -- newpos += 2; -- else -- newpos++; -+/* big5 functions */ -+#define big5_width(ch) ((ch)>0xff ? 2:1) -+ -+void unichars_to_big5(const unichar *str, char *out) -+{ -+ for (; *str != '\0'; str++) { -+ if(*str>0xff) -+ *out++ = (*str>>8)&0xff; -+ *out++ = *str&0xff; - } -+ *out = '\0'; -+} -+ -+void unichars_to_big5_with_pos(const unichar *str, int spos, char *out, int *opos) -+{ -+ const unichar *sstart = str; -+ char *ostart = out; - -- if (newpos != pos) -- pos += direct > 0 ? 1 : -1; -+ *opos = 0; -+ while(*str != '\0') -+ { -+ if(*str > 0xff) -+ *out ++ = (*str >> 8) & 0xff; -+ *out ++ = *str & 0xff; -+ str ++; -+ if(str - sstart == spos) -+ *opos = out - ostart; -+ } -+ *out = '\0'; -+} - -- return pos; -+int strlen_big5(const unsigned char *str) -+{ -+ int len=0; -+ -+ if(term_type!=TERM_TYPE_BIG5) -+ return strlen(str); -+ while(*str != '\0') { -+ if(is_big5(str[0],str[1])) -+ str++; -+ len++; -+ str++; -+ } -+ return len; -+} -+ -+void big5_to_unichars(const char *str, unichar *out) -+{ -+ const unsigned char *p = (const unsigned char *) str; -+ -+ while(*p != '\0') -+ if (is_big5(p[0], p[1])) { -+ *out++ = p[0] << 8 | p[1]; -+ p += 2; -+ } else -+ *out++ = *p++; -+ *out = '\0'; -+} -+ -+/* ----------------------------- */ -+ -+static int pos2scrpos(GUI_ENTRY_REC *entry, int pos) -+{ -+ unichar *p; -+ int xpos=0; -+ -+ for (p=entry->text;p-entry->text<pos;p++) -+ if (term_type == TERM_TYPE_BIG5) -+ xpos += big5_width(*p); -+ else if(entry->utf8) -+ xpos += utf8_width(*p); -+ else -+ xpos ++; -+ -+ return xpos; -+} -+ -+static int scrpos2pos(GUI_ENTRY_REC *entry, int pos) -+{ -+ int i; -+ int xpos=0; -+ -+ for(i=0; entry->text[i]; i++) { -+ int width; -+ unichar *p=entry->text+i; -+ -+ if(term_type == TERM_TYPE_BIG5) -+ width = big5_width(*p); -+ else if(entry->utf8) -+ width = utf8_width(*p); -+ else -+ width = 1; -+ if(xpos+width>pos) -+ break; -+ xpos+=width; -+ } -+ -+ if(xpos==pos) -+ return i; -+ else -+ return i-1; - } - - /* Fixes the cursor position in screen */ -@@ -97,20 +176,23 @@ - { - int old_scrstart; - -- old_scrstart = entry->scrstart; -- if (entry->pos - entry->scrstart < entry->width-2 - entry->promptlen && -- entry->pos - entry->scrstart > 0) { -- entry->scrpos = entry->pos - entry->scrstart; -- } else if (entry->pos < entry->width-1 - entry->promptlen) { -+ /* assume prompt len == prompt scrlen */ -+ int start=pos2scrpos(entry,entry->scrstart); -+ int now=pos2scrpos(entry,entry->pos); -+ -+ old_scrstart = entry->scrstart; -+ if (now-start < entry->width-2-entry->promptlen && -+ now-start > 0) -+ entry->scrpos=now-start; -+ else if(now < entry->width-1-entry->promptlen) { - entry->scrstart = 0; -- entry->scrpos = entry->pos; -+ entry->scrpos=now; - } else { -- entry->scrpos = (entry->width - entry->promptlen)*2/3; -- entry->scrstart = entry->pos - entry->scrpos; -+ entry->scrstart = scrpos2pos(entry,now-(entry->width - entry->promptlen)*2/3); -+ start=pos2scrpos(entry,entry->scrstart); -+ entry->scrpos=now-start; - } - -- entry->scrstart = _fix_big5_pos(entry->text, entry->scrstart, -1); -- - if (old_scrstart != entry->scrstart) - entry->redraw_needed_from = 0; - } -@@ -120,7 +202,9 @@ - const unichar *p; - int xpos, end_xpos; - -- xpos = entry->xpos + entry->promptlen + pos; -+ xpos = entry->xpos + entry->promptlen + -+ pos2scrpos(entry, pos + entry->scrstart) - -+ pos2scrpos(entry, entry->scrstart); - end_xpos = entry->xpos + entry->width; - if (xpos > end_xpos) - return; -@@ -131,8 +215,16 @@ - p = entry->scrstart + pos < entry->text_len ? - entry->text + entry->scrstart + pos : empty_str; - for (; *p != '\0'; p++) { -- xpos += utf8_width(*p); -- if (xpos > end_xpos) -+ if (entry->hidden) -+ xpos++; -+ else if(term_type == TERM_TYPE_BIG5) -+ xpos += big5_width(*p); -+ else if(entry->utf8) -+ xpos += utf8_width(*p); -+ else -+ xpos++; -+ -+ if (xpos >= end_xpos) - break; - - if (entry->hidden) -@@ -285,8 +377,34 @@ - if (entry->utf8) - utf16_to_utf8(entry->text, buf); - else { -- for (i = 0; i <= entry->text_len; i++) -- buf[i] = entry->text[i]; -+ if(term_type==TERM_TYPE_BIG5) -+ unichars_to_big5(entry->text, buf); -+ else -+ for (i = 0; i <= entry->text_len; i++) -+ buf[i] = entry->text[i]; -+ } -+ return buf; -+} -+ -+char *gui_entry_get_text_and_pos(GUI_ENTRY_REC *entry, int *pos) -+{ -+ char *buf; -+ int i; -+ -+ g_return_val_if_fail(entry != NULL, NULL); -+ -+ buf = g_malloc(entry->text_len*6 + 1); -+ if (entry->utf8) -+ utf16_to_utf8_with_pos(entry->text, entry->pos, buf, pos); -+ else { -+ if(term_type==TERM_TYPE_BIG5) -+ unichars_to_big5_with_pos(entry->text, entry->pos, buf, pos); -+ else -+ { -+ for (i = 0; i <= entry->text_len; i++) -+ buf[i] = entry->text[i]; -+ *pos = entry->pos; -+ } - } - return buf; - } -@@ -301,7 +419,7 @@ - - gui_entry_redraw_from(entry, entry->pos); - -- len = !entry->utf8 ? strlen(str) : strlen_utf8(str); -+ len = !entry->utf8 ? strlen_big5(str) : strlen_utf8(str); - entry_text_grow(entry, len); - - /* make space for the string */ -@@ -309,8 +427,13 @@ - (entry->text_len-entry->pos + 1) * sizeof(unichar)); - - if (!entry->utf8) { -- for (i = 0; i < len; i++) -- entry->text[entry->pos+i] = str[i]; -+ if (term_type == TERM_TYPE_BIG5) { -+ chr = entry->text[entry->pos+len]; -+ big5_to_unichars(str, entry->text+entry->pos); -+ entry->text[entry->pos+len] = chr; -+ } else -+ for (i = 0; i < len; i++) -+ entry->text[entry->pos + i] = str[i]; - } else { - chr = entry->text[entry->pos+len]; - utf8_to_utf16(str, entry->text+entry->pos); -@@ -361,8 +484,12 @@ - if (entry->utf8) - utf16_to_utf8(entry->cutbuffer, buf); - else { -- for (i = 0; i <= entry->cutbuffer_len; i++) -- buf[i] = entry->cutbuffer[i]; -+ if(term_type==TERM_TYPE_BIG5) { -+ unichars_to_big5(entry->cutbuffer, buf); -+ } else -+ for (i = 0; i <= entry->cutbuffer_len; i++) { -+ buf[i] = entry->cutbuffer[i]; -+ } - } - return buf; - } -@@ -374,24 +501,17 @@ - g_return_if_fail(entry != NULL); - - for (newpos = gui_entry_get_pos(entry); newpos > pos; size++) -- newpos = _fix_big5_pos(entry->text, newpos - 1, -1); -+ newpos = newpos - 1; - gui_entry_erase(entry, size, update_cutbuffer); - } - - void gui_entry_erase(GUI_ENTRY_REC *entry, int size, int update_cutbuffer) - { -- 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; -- - if (update_cutbuffer) { - /* put erased text to cutbuffer */ - if (entry->cutbuffer == NULL || entry->cutbuffer_len < size) { -@@ -513,26 +633,42 @@ - gui_entry_draw(entry); - } - --void gui_entry_move_pos(GUI_ENTRY_REC *entry, int pos) -+int gui_entry_linepos_to_pos(GUI_ENTRY_REC *entry, int linepos) - { -- int newpos; -- -- g_return_if_fail(entry != NULL); -+ int pos, len; - -- /* 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++; -+ for(pos = 0, len = 0; len < linepos; pos++) -+ { -+ if(entry->utf8) -+ len += utf16_char_to_utf8(entry->text[pos], NULL); -+ else if(term_type == TERM_TYPE_BIG5) -+ { -+ len += (entry->text[pos] > 0xff ? 2 : 1); - } -+ else -+ len ++; - } -- entry->pos = newpos; -+ return pos; -+} -+ -+void gui_entry_set_linepos(GUI_ENTRY_REC *entry, int pos) -+{ -+ g_return_if_fail(entry != NULL); -+ -+ pos = gui_entry_linepos_to_pos(entry, pos); -+ if (pos >= 0 && pos <= entry->text_len) -+ entry->pos = pos; -+ -+ gui_entry_fix_cursor(entry); -+ gui_entry_draw(entry); -+} -+ -+void gui_entry_move_pos(GUI_ENTRY_REC *entry, int pos) -+{ -+ g_return_if_fail(entry != NULL); -+ -+ if (entry->pos+pos >= 0 && entry->pos+pos <= entry->text_len) -+ entry->pos += pos; - - gui_entry_fix_cursor(entry); - gui_entry_draw(entry); diff --git a/chinese/irssi/files/patch-src::fe-text::gui-entry.h b/chinese/irssi/files/patch-src::fe-text::gui-entry.h deleted file mode 100644 index 471ba35ded10..000000000000 --- a/chinese/irssi/files/patch-src::fe-text::gui-entry.h +++ /dev/null @@ -1,18 +0,0 @@ ---- src/fe-text/gui-entry.h.orig Mon Oct 20 03:10:02 2003 -+++ src/fe-text/gui-entry.h Thu Apr 29 14:33:16 2004 -@@ -34,6 +34,7 @@ - - void gui_entry_set_text(GUI_ENTRY_REC *entry, const char *str); - char *gui_entry_get_text(GUI_ENTRY_REC *entry); -+char *gui_entry_get_text_and_pos(GUI_ENTRY_REC *entry, int *pos); - - void gui_entry_insert_text(GUI_ENTRY_REC *entry, const char *str); - void gui_entry_insert_char(GUI_ENTRY_REC *entry, unichar chr); -@@ -48,6 +49,7 @@ - - int gui_entry_get_pos(GUI_ENTRY_REC *entry); - void gui_entry_set_pos(GUI_ENTRY_REC *entry, int pos); -+void gui_entry_set_linepos(GUI_ENTRY_REC *entry, int pos); - void gui_entry_move_pos(GUI_ENTRY_REC *entry, int pos); - void gui_entry_move_words(GUI_ENTRY_REC *entry, int count, int to_space); - diff --git a/chinese/irssi/files/patch-src::fe-text::gui-printtext.c b/chinese/irssi/files/patch-src::fe-text::gui-printtext.c deleted file mode 100644 index 7833a289a463..000000000000 --- a/chinese/irssi/files/patch-src::fe-text::gui-printtext.c +++ /dev/null @@ -1,11 +0,0 @@ ---- src/fe-text/gui-printtext.c.orig Mon Dec 30 00:10:02 2002 -+++ src/fe-text/gui-printtext.c Sun Dec 14 01:54:28 2003 -@@ -255,7 +255,7 @@ - if (flags & GUI_PRINT_FLAG_CLRTOEOL) - term_clrtoeol(root_window); - term_addstr(root_window, str); -- next_xpos += strlen(str); -+ next_xpos += strlen(str); // FIXME utf8 or big5 - return; - } - diff --git a/chinese/irssi/files/patch-src::fe-text::gui-readline.c b/chinese/irssi/files/patch-src::fe-text::gui-readline.c deleted file mode 100644 index 77dd303e2314..000000000000 --- a/chinese/irssi/files/patch-src::fe-text::gui-readline.c +++ /dev/null @@ -1,52 +0,0 @@ ---- src/fe-text/gui-readline.c.orig Thu Nov 27 01:30:03 2003 -+++ src/fe-text/gui-readline.c Thu Apr 29 14:33:01 2004 -@@ -187,7 +187,12 @@ - out[utf16_char_to_utf8(arr[i], out)] = '\0'; - g_string_append(str, out); - } else { -- g_string_append_c(str, arr[i]); -+ if(term_type==TERM_TYPE_BIG5) { -+ if(arr[i]>0xff) -+ g_string_append_c(str, arr[i]>>8&0xff); -+ g_string_append_c(str, arr[i]&0xff); -+ } else -+ g_string_append_c(str, arr[i]); - } - } - -@@ -620,15 +625,13 @@ - char *text, *line; - int pos; - -- pos = gui_entry_get_pos(active_entry); -- -- text = gui_entry_get_text(active_entry); -+ text = gui_entry_get_text_and_pos(active_entry, &pos); - line = word_complete(active_win, text, &pos, erase); - g_free(text); - - if (line != NULL) { - gui_entry_set_text(active_entry, line); -- gui_entry_set_pos(active_entry, pos); -+ gui_entry_set_linepos(active_entry, pos); - g_free(line); - } - } -@@ -648,15 +651,13 @@ - char *text, *line; - int pos; - -- pos = gui_entry_get_pos(active_entry); -- -- text = gui_entry_get_text(active_entry); -+ text = gui_entry_get_text_and_pos(active_entry, &pos); - line = auto_word_complete(text, &pos); - g_free(text); - - if (line != NULL) { - gui_entry_set_text(active_entry, line); -- gui_entry_set_pos(active_entry, pos); -+ gui_entry_set_linepos(active_entry, pos); - g_free(line); - } - } diff --git a/chinese/irssi/files/patch-src::fe-text::term-terminfo.c b/chinese/irssi/files/patch-src::fe-text::term-terminfo.c deleted file mode 100644 index eb2e26ceaa35..000000000000 --- a/chinese/irssi/files/patch-src::fe-text::term-terminfo.c +++ /dev/null @@ -1,44 +0,0 @@ ---- src/fe-text/term-terminfo.c.orig Mon Oct 20 03:10:02 2003 -+++ src/fe-text/term-terminfo.c Sun Apr 11 21:11:41 2004 -@@ -421,16 +421,21 @@ - if (vcy == term_height-1 && vcx == term_width-1) - return; /* last char in screen */ - -- term_printed_text(1); - switch (term_type) { - case TERM_TYPE_UTF8: -+ term_printed_text(utf8_width(chr)); - term_addch_utf8(window, chr); - break; - case TERM_TYPE_BIG5: -- putc((chr >> 8) & 0xff, window->term->out); -+ if(chr>0xff) { -+ term_printed_text(2); -+ putc((chr >> 8) & 0xff, window->term->out); -+ } else -+ term_printed_text(1); - putc((chr & 0xff), window->term->out); - break; - default: -+ term_printed_text(1); - putc(chr, window->term->out); - break; - } -@@ -443,7 +448,7 @@ - if (term_detached) return; - - if (vcmove) term_move_real(); -- len = strlen(str); -+ len = strlen(str); // FIXME utf8 or big5 - term_printed_text(len); - - if (vcy != term_height || vcx != 0) -@@ -640,7 +645,7 @@ - if (i >= term_inbuf_pos) - term_inbuf_pos = 0; - else if (i > 0) { -- memmove(term_inbuf+i, term_inbuf, term_inbuf_pos-i); -+ memmove(term_inbuf, term_inbuf+i, term_inbuf_pos-i); - term_inbuf_pos -= i; - } - } diff --git a/chinese/irssi/files/patch-src::fe-text::textbuffer-view.c b/chinese/irssi/files/patch-src::fe-text::textbuffer-view.c deleted file mode 100644 index d3e02fc8c355..000000000000 --- a/chinese/irssi/files/patch-src::fe-text::textbuffer-view.c +++ /dev/null @@ -1,18 +0,0 @@ ---- src/fe-text/textbuffer-view.c.orig Sun Oct 26 13:45:02 2003 -+++ src/fe-text/textbuffer-view.c Sun Dec 14 01:54:28 2003 -@@ -435,7 +435,14 @@ - unichar chr = get_utf8_char(&end, 6); - char_width = utf8_width(chr); - } else { -- char_width = 1; -+ if(term_type==TERM_TYPE_BIG5) { -+ if(is_big5(end[0],end[1])) -+ char_width=2; -+ else -+ char_width=1; -+ } else -+ char_width = 1; -+ end+=char_width-1; - } - - xpos += char_width; diff --git a/chinese/irssi/files/patch-src::fe-text::utf8.c b/chinese/irssi/files/patch-src::fe-text::utf8.c deleted file mode 100644 index 433fefee1464..000000000000 --- a/chinese/irssi/files/patch-src::fe-text::utf8.c +++ /dev/null @@ -1,27 +0,0 @@ ---- src/fe-text/utf8.c.orig Tue Oct 15 02:45:08 2002 -+++ src/fe-text/utf8.c Wed Apr 7 11:04:22 2004 -@@ -180,6 +180,24 @@ - *out = '\0'; - } - -+void utf16_to_utf8_with_pos(const unichar *str, int spos, char *out, int *opos) -+{ -+ int len; -+ const unichar *sstart = str; -+ char *ostart = out; -+ -+ *opos = 0; -+ while (*str != '\0') { -+ len = utf16_char_to_utf8(*str, out); -+ out += len; -+ -+ str++; -+ if(str - sstart == spos) -+ *opos = out - ostart; -+ } -+ *out = '\0'; -+} -+ - static const unichar wcc[] = { - 0x0, 0x300, 0x34F, 0x360, 0x363, 0x483, 0x487, 0x488, 0x48A, 0x591, - 0x5A2, 0x5A3, 0x5BA, 0x5BB, 0x5BE, 0x5BF, 0x5C0, 0x5C1, 0x5C3, 0x5C4, diff --git a/chinese/irssi/files/patch-src::fe-text::utf8.h b/chinese/irssi/files/patch-src::fe-text::utf8.h deleted file mode 100644 index e9deb6b55477..000000000000 --- a/chinese/irssi/files/patch-src::fe-text::utf8.h +++ /dev/null @@ -1,13 +0,0 @@ ---- src/fe-text/utf8.h.orig Mon Oct 20 03:10:02 2003 -+++ src/fe-text/utf8.h Wed Apr 7 11:06:22 2004 -@@ -18,6 +18,10 @@ - Make sure out is at least 6 x length of str. */ - void utf16_to_utf8(const unichar *str, char *out); - -+/* unichar -> UTF-8 string with position transformed. The NUL is copied as well. -+ Make sure out is at least 6 x length of str. */ -+void utf16_to_utf8_with_pos(const unichar *str, int spos, char *out, int *opos); -+ - /* 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 */ |