diff options
author | Vanilla I. Shu <vanilla@FreeBSD.org> | 2004-04-07 04:13:35 +0000 |
---|---|---|
committer | Vanilla I. Shu <vanilla@FreeBSD.org> | 2004-04-07 04:13:35 +0000 |
commit | 6a4ea2dc79142ea9276d17532b53919cfa626edb (patch) | |
tree | 64cf06366af351a70708bd69d855f7a58361f011 /chinese | |
parent | 96deac438e4f294fbfb1c37d78f24a2f71ec3285 (diff) | |
download | ports-6a4ea2dc79142ea9276d17532b53919cfa626edb.tar.gz ports-6a4ea2dc79142ea9276d17532b53919cfa626edb.zip |
Notes
Diffstat (limited to 'chinese')
-rw-r--r-- | chinese/irssi/Makefile | 8 | ||||
-rw-r--r-- | chinese/irssi/files/patch-src::fe-text::gui-entry.c | 71 | ||||
-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 | 24 | ||||
-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 |
6 files changed, 134 insertions, 19 deletions
diff --git a/chinese/irssi/Makefile b/chinese/irssi/Makefile index 249611804b07..cad97a8b8916 100644 --- a/chinese/irssi/Makefile +++ b/chinese/irssi/Makefile @@ -15,12 +15,14 @@ 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::textbuffer-view.c \ + ${.CURDIR}/files/patch-src::fe-text::utf8.c \ + ${.CURDIR}/files/patch-src::fe-text::utf8.h +PKGNAMEPREFIX:= ${PKGNAMEPREFIX}tw- .include "${MASTERDIR}/Makefile" - -PKGNAMEPREFIX:= ${PKGNAMEPREFIX}tw- 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 4cfc86372d8c..668df76c36bb 100644 --- a/chinese/irssi/files/patch-src::fe-text::gui-entry.c +++ b/chinese/irssi/files/patch-src::fe-text::gui-entry.c @@ -1,6 +1,6 @@ --- src/fe-text/gui-entry.c.orig Sun Oct 26 13:45:02 2003 -+++ src/fe-text/gui-entry.c Sun Dec 14 01:54:28 2003 -@@ -68,28 +68,89 @@ ++++ src/fe-text/gui-entry.c Wed Apr 7 11:08:29 2004 +@@ -68,28 +68,107 @@ g_free(entry); } @@ -29,6 +29,26 @@ + if(*str>0xff) + *out++ = (*str>>8)&0xff; + *out++ = *str&0xff; + } ++ *out = '\0'; ++} + +- if (newpos != pos) +- pos += direct > 0 ? 1 : -1; ++void unichars_to_big5_with_pos(const unichar *str, int spos, char *out, int *opos) ++{ ++ const unichar *sstart = str; ++ char *ostart = out; ++ ++ *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'; +} @@ -44,7 +64,7 @@ + str++; + len++; + str++; - } ++ } + return len; +} + @@ -83,9 +103,7 @@ +{ + int i; + int xpos=0; - -- if (newpos != pos) -- pos += direct > 0 ? 1 : -1; ++ + for(i=0; entry->text[i]; i++) { + int width; + unichar *p=entry->text+i; @@ -109,7 +127,7 @@ } /* Fixes the cursor position in screen */ -@@ -97,20 +158,23 @@ +@@ -97,20 +176,23 @@ { int old_scrstart; @@ -143,7 +161,7 @@ if (old_scrstart != entry->scrstart) entry->redraw_needed_from = 0; } -@@ -120,7 +184,9 @@ +@@ -120,7 +202,9 @@ const unichar *p; int xpos, end_xpos; @@ -154,7 +172,7 @@ end_xpos = entry->xpos + entry->width; if (xpos > end_xpos) return; -@@ -131,7 +197,15 @@ +@@ -131,7 +215,15 @@ p = entry->scrstart + pos < entry->text_len ? entry->text + entry->scrstart + pos : empty_str; for (; *p != '\0'; p++) { @@ -171,7 +189,7 @@ if (xpos > end_xpos) break; -@@ -285,8 +359,11 @@ +@@ -285,8 +377,34 @@ if (entry->utf8) utf16_to_utf8(entry->text, buf); else { @@ -182,10 +200,33 @@ + 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 +378,7 @@ +@@ -301,7 +419,7 @@ gui_entry_redraw_from(entry, entry->pos); @@ -194,7 +235,7 @@ entry_text_grow(entry, len); /* make space for the string */ -@@ -309,8 +386,13 @@ +@@ -309,8 +427,13 @@ (entry->text_len-entry->pos + 1) * sizeof(unichar)); if (!entry->utf8) { @@ -210,7 +251,7 @@ } else { chr = entry->text[entry->pos+len]; utf8_to_utf16(str, entry->text+entry->pos); -@@ -361,8 +443,12 @@ +@@ -361,8 +484,12 @@ if (entry->utf8) utf16_to_utf8(entry->cutbuffer, buf); else { @@ -225,7 +266,7 @@ } return buf; } -@@ -374,24 +460,17 @@ +@@ -374,24 +501,17 @@ g_return_if_fail(entry != NULL); for (newpos = gui_entry_get_pos(entry); newpos > pos; size++) @@ -251,7 +292,7 @@ if (update_cutbuffer) { /* put erased text to cutbuffer */ if (entry->cutbuffer == NULL || entry->cutbuffer_len < size) { -@@ -515,24 +594,10 @@ +@@ -515,24 +635,10 @@ void gui_entry_move_pos(GUI_ENTRY_REC *entry, int pos) { diff --git a/chinese/irssi/files/patch-src::fe-text::gui-entry.h b/chinese/irssi/files/patch-src::fe-text::gui-entry.h new file mode 100644 index 000000000000..9b958faf4009 --- /dev/null +++ b/chinese/irssi/files/patch-src::fe-text::gui-entry.h @@ -0,0 +1,10 @@ +--- src/fe-text/gui-entry.h.orig Mon Oct 20 03:10:02 2003 ++++ src/fe-text/gui-entry.h Wed Apr 7 11:01:59 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); 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 64be698943fe..99e673023ca6 100644 --- a/chinese/irssi/files/patch-src::fe-text::gui-readline.c +++ b/chinese/irssi/files/patch-src::fe-text::gui-readline.c @@ -1,5 +1,5 @@ --- src/fe-text/gui-readline.c.orig Thu Nov 27 01:30:03 2003 -+++ src/fe-text/gui-readline.c Sun Dec 14 01:54:28 2003 ++++ src/fe-text/gui-readline.c Wed Apr 7 11:02:59 2004 @@ -187,7 +187,12 @@ out[utf16_char_to_utf8(arr[i], out)] = '\0'; g_string_append(str, out); @@ -14,3 +14,25 @@ } } +@@ -620,9 +625,7 @@ + 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); + +@@ -648,9 +651,7 @@ + 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); + diff --git a/chinese/irssi/files/patch-src::fe-text::utf8.c b/chinese/irssi/files/patch-src::fe-text::utf8.c new file mode 100644 index 000000000000..433fefee1464 --- /dev/null +++ b/chinese/irssi/files/patch-src::fe-text::utf8.c @@ -0,0 +1,27 @@ +--- 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 new file mode 100644 index 000000000000..e9deb6b55477 --- /dev/null +++ b/chinese/irssi/files/patch-src::fe-text::utf8.h @@ -0,0 +1,13 @@ +--- 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 */ |