diff options
-rw-r--r-- | chinese/irssi/Makefile | 21 | ||||
-rw-r--r-- | chinese/irssi/files/patch-irssi.conf | 8 | ||||
-rw-r--r-- | chinese/irssi/files/patch-src::fe-text::gui-entry.c | 105 | ||||
-rw-r--r-- | chinese/irssi/files/patch-src::fe-text::gui-entry.h | 10 | ||||
-rw-r--r-- | chinese/irssi/files/patch-src::fe-text::gui-readline.c | 53 | ||||
-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 | 35 | ||||
-rw-r--r-- | chinese/irssi/files/patch-src::fe-text::utf8.h | 16 |
8 files changed, 47 insertions, 216 deletions
diff --git a/chinese/irssi/Makefile b/chinese/irssi/Makefile index 009211f..ebaab52 100644 --- a/chinese/irssi/Makefile +++ b/chinese/irssi/Makefile @@ -5,22 +5,19 @@ # $FreeBSD$ # -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-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.h - -PORTREVISION= 4 +PORTREVISION= 0 CATEGORIES= chinese MAINTAINER= vanilla@FreeBSD.org COMMENT= A zh-tw cursor movement friendly, wrapping clean irssi -.include "${MASTERDIR}/Makefile" +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-readline.c -PKGNAMEPREFIX:= ${PKGNAMEPREFIX}tw- +.include "${MASTERDIR}/Makefile" +PKGNAMEPREFIX:= ${PKGNAMEPREFIX}tw- diff --git a/chinese/irssi/files/patch-irssi.conf b/chinese/irssi/files/patch-irssi.conf index b32f416..05d360f 100644 --- a/chinese/irssi/files/patch-irssi.conf +++ b/chinese/irssi/files/patch-irssi.conf @@ -1,5 +1,5 @@ ---- irssi.conf.orig Thu Sep 12 07:00:08 2002 -+++ irssi.conf Sat Nov 23 18:28:25 2002 +--- irssi.conf.orig Sun Dec 7 16:25:52 2003 ++++ irssi.conf Sun Dec 7 16:29:49 2003 @@ -1,115 +1,17 @@ servers = ( - { address = "irc.stealth.net"; chatnet = "IRCnet"; port = "6668"; }, @@ -25,7 +25,7 @@ - }, - { address = "irc.ptnet.org"; chatnet = "PTnet"; port = "6667"; }, - { address = "irc.azzurra.org"; chatnet = "AzzurraNET"; port = "6667"; }, -- { address = "silc.pspt.fi"; chatnet = "SILC"; port = "706"; } +- { 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"; }, @@ -118,7 +118,7 @@ channels = ( - { name = "#irssi"; chatnet = "ircnet"; autojoin = "No"; }, - { name = "#irssi"; chatnet = "freenode"; autojoin = "No"; }, -- { name = "#silc"; chatnet = "silc"; 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 index e40b933..050838b 100644 --- a/chinese/irssi/files/patch-src::fe-text::gui-entry.c +++ b/chinese/irssi/files/patch-src::fe-text::gui-entry.c @@ -1,43 +1,6 @@ ---- src/fe-text/gui-entry.c.orig Tue Oct 15 02:45:08 2002 -+++ src/fe-text/gui-entry.c Sun Dec 29 19:18:05 2002 -@@ -68,6 +68,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) - { -@@ -85,6 +106,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; - } -@@ -200,7 +223,7 @@ +--- src/fe-text/gui-entry.c.orig Sun Oct 26 13:45:02 2003 ++++ src/fe-text/gui-entry.c Sun Dec 7 16:33:14 2003 +@@ -226,7 +226,7 @@ } } @@ -46,7 +9,7 @@ { int oldlen; -@@ -236,7 +259,7 @@ +@@ -262,7 +262,7 @@ entry->utf8 = utf8; } @@ -55,7 +18,7 @@ { g_return_if_fail(entry != NULL); g_return_if_fail(str != NULL); -@@ -265,7 +288,7 @@ +@@ -291,7 +291,7 @@ return buf; } @@ -64,61 +27,3 @@ { unichar chr; int i, len; -@@ -341,13 +364,30 @@ - return buf; - } - -+void gui_entry_erase_to(GUI_ENTRY_REC *entry, int pos, int update_cutbuffer) -+{ -+ int newpos, size = 0; -+ -+ 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); -+ 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) { -@@ -471,10 +511,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::gui-entry.h b/chinese/irssi/files/patch-src::fe-text::gui-entry.h index 4b1a295..6bdd61b 100644 --- a/chinese/irssi/files/patch-src::fe-text::gui-entry.h +++ b/chinese/irssi/files/patch-src::fe-text::gui-entry.h @@ -1,6 +1,6 @@ ---- src/fe-text/gui-entry.h.orig Wed Feb 20 20:46:45 2002 -+++ src/fe-text/gui-entry.h Sun Dec 29 19:19:26 2002 -@@ -28,17 +28,18 @@ +--- src/fe-text/gui-entry.h.orig Mon Oct 20 03:10:02 2003 ++++ src/fe-text/gui-entry.h Sun Dec 7 16:34:09 2003 +@@ -28,14 +28,14 @@ void gui_entry_move(GUI_ENTRY_REC *entry, int xpos, int ypos, int width); void gui_entry_set_active(GUI_ENTRY_REC *entry); @@ -18,7 +18,3 @@ void gui_entry_insert_char(GUI_ENTRY_REC *entry, unichar chr); char *gui_entry_get_cutbuffer(GUI_ENTRY_REC *entry); -+void gui_entry_erase_to(GUI_ENTRY_REC *entry, int pos, int update_cutbuffer); - void gui_entry_erase(GUI_ENTRY_REC *entry, int size, int update_cutbuffer); - void gui_entry_erase_word(GUI_ENTRY_REC *entry, int to_space); - void gui_entry_erase_next_word(GUI_ENTRY_REC *entry, int to_space); diff --git a/chinese/irssi/files/patch-src::fe-text::gui-readline.c b/chinese/irssi/files/patch-src::fe-text::gui-readline.c index 5b514ef..29bf194 100644 --- a/chinese/irssi/files/patch-src::fe-text::gui-readline.c +++ b/chinese/irssi/files/patch-src::fe-text::gui-readline.c @@ -1,39 +1,38 @@ ---- src/fe-text/gui-readline.c.orig Mon Nov 11 15:00:02 2002 -+++ src/fe-text/gui-readline.c Tue Apr 1 09:47:02 2003 -@@ -50,6 +50,10 @@ +--- src/fe-text/gui-readline.c.orig Sun Nov 23 20:30:02 2003 ++++ src/fe-text/gui-readline.c Sun Dec 7 16:35:50 2003 +@@ -53,6 +53,9 @@ static ENTRY_REDIRECT_REC *redir; static int escape_next_key; +static int big5high = FALSE; +static unichar prekey = '\0'; + -+ static int readtag; - static time_t idle_time; - -@@ -148,7 +152,25 @@ - - idle_time = time(NULL); + static unichar prev_key; + static GTimeVal last_keypress; +@@ -339,7 +342,25 @@ + return; + } - if (key < 32) { -+ if(big5high || is_big5_hi(key)) -+ { -+ if(big5high) -+ { -+ big5high = FALSE; -+ str[0] = prekey; -+ str[1] = key; -+ str[2] = '\0'; -+ gui_entry_insert_text(active_entry, str); -+ return; -+ } -+ else -+ { -+ big5high = TRUE; -+ prekey = key; -+ return; -+ } -+ } ++ if(big5high || is_big5_hi(key)) ++ { ++ if(big5high) ++ { ++ big5high = FALSE; ++ str[0] = prekey; ++ str[1] = key; ++ str[2] = '\0'; ++ gui_entry_insert_text(active_entry, str); ++ return; ++ } ++ else ++ { ++ big5high = TRUE; ++ prekey = key; ++ return; ++ } ++ } + else if (key < 32) { /* control key */ str[0] = '^'; 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 ccb9b26..0000000 --- a/chinese/irssi/files/patch-src::fe-text::term-terminfo.c +++ /dev/null @@ -1,15 +0,0 @@ ---- src/fe-text/term-terminfo.c.orig Sun May 12 22:48:11 2002 -+++ src/fe-text/term-terminfo.c Sat Nov 23 17:28:36 2002 -@@ -564,12 +564,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 deleted file mode 100644 index f53f3d9..0000000 --- a/chinese/irssi/files/patch-src::fe-text::textbuffer-view.c +++ /dev/null @@ -1,35 +0,0 @@ ---- src/fe-text/textbuffer-view.c.orig Tue Oct 15 02:45:08 2002 -+++ src/fe-text/textbuffer-view.c Sat Nov 23 18:04:04 2002 -@@ -199,8 +199,14 @@ - } - - if (!view->utf8) { -- next_ptr = ptr+1; -+ /* MH */ - char_len = 1; -+ if(ptr[1] != '\0' && is_big5(ptr[0], ptr[1])) -+ { -+ char_len = 2; -+ } -+ next_ptr = ptr+char_len; -+ /* */ - } else { - char_len = 1; - while (ptr[char_len] != '\0' && char_len < 6) -@@ -251,7 +257,15 @@ - continue; - } - -- if (*ptr == ' ') { -+ /* MH */ -+ if (!view->utf8 && char_len > 1) -+ { -+ last_space = xpos; -+ last_space_ptr = next_ptr; -+ last_color = color; -+ } -+ /* */ -+ else if (*ptr == ' ') { - last_space = xpos; - last_space_ptr = ptr; - last_color = color; 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 7be1235..0000000 --- a/chinese/irssi/files/patch-src::fe-text::utf8.h +++ /dev/null @@ -1,16 +0,0 @@ ---- src/fe-text/utf8.h.orig Tue Oct 15 02:45:08 2002 -+++ src/fe-text/utf8.h Sat Nov 23 17:28:38 2002 -@@ -18,6 +18,13 @@ - 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)) -+ - /* Returns width for character (0-2). */ - int utf8_width(unichar c); - |