diff options
author | vanilla <vanilla@FreeBSD.org> | 2004-04-30 03:56:33 +0800 |
---|---|---|
committer | vanilla <vanilla@FreeBSD.org> | 2004-04-30 03:56:33 +0800 |
commit | d75dc1d46a6034330f3257ca620ed0a7bdcbe811 (patch) | |
tree | c2aab96a031a31bab4fa8816204153a134b40899 /chinese/irssi | |
parent | a9ea4d14af972e971939268207af5efd7b299f88 (diff) | |
download | freebsd-ports-gnome-d75dc1d46a6034330f3257ca620ed0a7bdcbe811.tar.gz freebsd-ports-gnome-d75dc1d46a6034330f3257ca620ed0a7bdcbe811.tar.zst freebsd-ports-gnome-d75dc1d46a6034330f3257ca620ed0a7bdcbe811.zip |
Yet another input buffer patch.
Submitted by: mhsin via #bsdchat
Diffstat (limited to 'chinese/irssi')
-rw-r--r-- | chinese/irssi/Makefile | 2 | ||||
-rw-r--r-- | chinese/irssi/files/patch-src::fe-text::gui-entry.c | 58 | ||||
-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 | 20 |
4 files changed, 72 insertions, 18 deletions
diff --git a/chinese/irssi/Makefile b/chinese/irssi/Makefile index d30b52d19b43..366db708abe7 100644 --- a/chinese/irssi/Makefile +++ b/chinese/irssi/Makefile @@ -5,7 +5,7 @@ # $FreeBSD$ # -PORTREVISION= 4 +PORTREVISION= 5 CATEGORIES= chinese MAINTAINER= vanilla@FreeBSD.org 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 a7d5255c6172..a6e7e3254787 100644 --- a/chinese/irssi/files/patch-src::fe-text::gui-entry.c +++ b/chinese/irssi/files/patch-src::fe-text::gui-entry.c @@ -1,5 +1,5 @@ --- src/fe-text/gui-entry.c.orig Sun Oct 26 13:45:02 2003 -+++ src/fe-text/gui-entry.c Tue Apr 13 23:27:34 2004 ++++ src/fe-text/gui-entry.c Thu Apr 29 14:33:53 2004 @@ -68,28 +68,107 @@ g_free(entry); } @@ -32,14 +32,14 @@ } + *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; -+ + +- if (newpos != pos) +- pos += direct > 0 ? 1 : -1; + *opos = 0; + while(*str != '\0') + { @@ -52,7 +52,8 @@ + } + *out = '\0'; +} -+ + +- return pos; +int strlen_big5(const unsigned char *str) +{ + int len=0; @@ -118,8 +119,7 @@ + break; + xpos+=width; + } - -- return pos; ++ + if(xpos==pos) + return i; + else @@ -294,13 +294,17 @@ if (update_cutbuffer) { /* put erased text to cutbuffer */ if (entry->cutbuffer == NULL || entry->cutbuffer_len < size) { -@@ -515,24 +635,10 @@ +@@ -513,26 +633,42 @@ + gui_entry_draw(entry); + } - void gui_entry_move_pos(GUI_ENTRY_REC *entry, int pos) +-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); +- g_return_if_fail(entry != NULL); ++ int pos, len; - /* move cursor with big5 charset */ - newpos = _fix_big5_pos(entry->text, entry->pos, -1); @@ -313,9 +317,37 @@ - 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; 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 9b958faf4009..471ba35ded10 100644 --- a/chinese/irssi/files/patch-src::fe-text::gui-entry.h +++ b/chinese/irssi/files/patch-src::fe-text::gui-entry.h @@ -1,5 +1,5 @@ --- 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 ++++ 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); @@ -8,3 +8,11 @@ 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-readline.c b/chinese/irssi/files/patch-src::fe-text::gui-readline.c index 99e673023ca6..77dd303e2314 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 Wed Apr 7 11:02:59 2004 ++++ 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); @@ -14,7 +14,7 @@ } } -@@ -620,9 +625,7 @@ +@@ -620,15 +625,13 @@ char *text, *line; int pos; @@ -25,7 +25,14 @@ line = word_complete(active_win, text, &pos, erase); g_free(text); -@@ -648,9 +651,7 @@ + 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; @@ -36,3 +43,10 @@ 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); + } + } |