diff options
author | clive <clive@FreeBSD.org> | 2002-07-06 20:55:59 +0000 |
---|---|---|
committer | clive <clive@FreeBSD.org> | 2002-07-06 20:55:59 +0000 |
commit | a2a6ec4dde89006dd2e2849491b47a19058774ce (patch) | |
tree | f9addb669f9d267493f8e3909b451e64a4d69468 /chinese/bitchx/files | |
parent | e2278d4d68a0e6543a910cb56bc8fe4369be2e64 (diff) | |
download | FreeBSD-ports-a2a6ec4dde89006dd2e2849491b47a19058774ce.zip FreeBSD-ports-a2a6ec4dde89006dd2e2849491b47a19058774ce.tar.gz |
Fix a longstanding bug, due to bogus big5 encoding. (There is hi-byte,
low-byte, and encoding range of hi-byte and low-byte overlap each other.)
Diffstat (limited to 'chinese/bitchx/files')
-rw-r--r-- | chinese/bitchx/files/patch-source::input.c | 61 |
1 files changed, 50 insertions, 11 deletions
diff --git a/chinese/bitchx/files/patch-source::input.c b/chinese/bitchx/files/patch-source::input.c index 473a157..c49d6b4e 100644 --- a/chinese/bitchx/files/patch-source::input.c +++ b/chinese/bitchx/files/patch-source::input.c @@ -1,6 +1,6 @@ ---- source/input.c~ Mon Jan 8 15:06:30 2001 +--- source/input.c~ Sun Jul 7 04:33:05 2002 +++ source/input.c Mon Jan 8 01:09:28 2001 -@@ -89,6 +89,7 @@ +@@ -94,6 +94,7 @@ #define MIN_CHAR INPUT_BUFFER[MIN_POS] #define PREV_CHAR INPUT_BUFFER[THIS_POS-1] #define NEXT_CHAR INPUT_BUFFER[THIS_POS+1] @@ -8,7 +8,45 @@ #define ADD_TO_INPUT(x) strmcat(INPUT_BUFFER, (x), INPUT_BUFFER_SIZE); #define INPUT_ONSCREEN current_screen->input_visible #define INPUT_VISIBLE INPUT_BUFFER[INPUT_ONSCREEN] -@@ -473,6 +474,13 @@ +@@ -107,7 +108,11 @@ + + + #define HOLDLAST current_screen->current_window->screen_hold +- ++ ++#define MY_ROLE_ENG 0 ++#define MY_ROLE_HI 1 ++#define MY_ROLE_LO 2 ++ + Display *get_screen_hold(Window *win) + { + return win->screen_hold; +@@ -124,6 +129,24 @@ + return i; + } + ++static int check_my_role (int my_pos) ++{ ++ int i = MIN_POS; ++ while (i <= my_pos) { ++ if ( is_big5_hi( INPUT_BUFFER[i] ) ) { ++ if ( i+1 <= my_pos ) { ++ if (is_big5( INPUT_BUFFER[i],INPUT_BUFFER[i+1]) ){ ++ if (i+1 == my_pos) return MY_ROLE_LO; ++ else i+=1; ++ } ++ } ++ else return MY_ROLE_HI; ++ } ++ i+=1; ++ } ++ return MY_ROLE_ENG; ++} ++ + /* cursor_to_input: move the cursor to the input line, if not there already */ + extern void BX_cursor_to_input (void) + { +@@ -480,6 +503,13 @@ { if (THIS_CHAR) { @@ -22,12 +60,12 @@ THIS_POS++; term_cursor_right(); } -@@ -483,6 +491,13 @@ +@@ -490,6 +520,13 @@ { THIS_POS--; term_cursor_left(); +#ifdef WANT_BIG5 -+ if (is_big5(PREV_CHAR,THIS_CHAR)) ++ if ( check_my_role(THIS_POS) == MY_ROLE_LO) + { + THIS_POS--; + term_cursor_left(); @@ -36,7 +74,7 @@ } } update_input(NO_UPDATE); -@@ -577,15 +592,33 @@ +@@ -584,15 +621,33 @@ BUILT_IN_KEYBINDING(input_delete_character) { int pos; @@ -70,7 +108,7 @@ term_delete(1); pos = INPUT_ONSCREEN + last_input_screen->co - 1; if (pos < strlen(INPUT_BUFFER)) -@@ -594,6 +627,9 @@ +@@ -601,6 +656,9 @@ term_putchar(INPUT_BUFFER[pos]); term_move_cursor(INPUT_CURSOR, INPUT_LINE); } @@ -80,7 +118,7 @@ update_input(NO_UPDATE); } } -@@ -607,6 +643,14 @@ +@@ -614,6 +672,15 @@ char *ptr = NULL; int pos; @@ -88,14 +126,15 @@ + int count=1 ; +#endif +#ifdef WANT_BIG5 -+ if ( *(&PREV_CHAR-sizeof(char)) && (is_big5(*(&PREV_CHAR-sizeof(char)),PREV_CHAR))) ++ if ( check_my_role(THIS_POS -1 ) == MY_ROLE_LO) + count=2 ; ++ + while (count-->0) { +#endif ptr = LOCAL_COPY(&THIS_CHAR); strcpy(&(PREV_CHAR), ptr); THIS_POS--; -@@ -643,6 +687,9 @@ +@@ -650,6 +717,9 @@ update_input(UPDATE_FROM_CURSOR); #endif } @@ -105,7 +144,7 @@ } if (THIS_POS == MIN_POS) HOLDLAST = NULL; -@@ -681,6 +728,10 @@ +@@ -688,6 +758,10 @@ { cursor_to_input(); THIS_POS = strlen(INPUT_BUFFER); |