Fixed Bug 512108 issue 11

epel9
Ding-Yi Chen 16 years ago
parent f42a2fbcfc
commit 51c223e5db

@ -12,3 +12,4 @@ libchewing-0_3_2-10_fc11:HEAD:libchewing-0.3.2-10.fc11.src.rpm:1242803240
libchewing-0_3_2-11_fc11:HEAD:libchewing-0.3.2-11.fc11.src.rpm:1245996227
libchewing-0_3_2-12_fc11:HEAD:libchewing-0.3.2-12.fc11.src.rpm:1246329909
libchewing-0_3_2-14_fc11:HEAD:libchewing-0.3.2-14.fc11.src.rpm:1249025558
libchewing-0_3_2-15_fc11:HEAD:libchewing-0.3.2-15.fc11.src.rpm:1249275193

@ -1,6 +1,6 @@
diff -up ./src/chewingio.c.phraseChoiceRearward ./src/chewingio.c
--- ./src/chewingio.c.phraseChoiceRearward 2008-12-02 00:29:20.000000000 +1000
+++ ./src/chewingio.c 2009-07-31 17:17:06.000000000 +1000
+++ ./src/chewingio.c 2009-08-03 14:46:41.000000000 +1000
@@ -20,6 +20,7 @@
#include <string.h>
#include <ctype.h>
@ -9,7 +9,20 @@ diff -up ./src/chewingio.c.phraseChoiceRearward ./src/chewingio.c
#include "chewing-utf8-util.h"
#include "global.h"
@@ -75,14 +76,14 @@ CHEWING_API int chewing_KBStr2Num( char
@@ -50,6 +51,12 @@ void (*TerminateServices[ TerminateServi
static int countTerminateService = 0;
static int bTerminateCompleted = 0;
+/**
+ * This has to be global, as user might mixed space and down
+ * key as selection starter.
+ */
+static int cursor_orig=-1;
+
char *kb_type_str[] = {
"KB_DEFAULT",
"KB_HSU",
@@ -75,14 +82,14 @@ CHEWING_API int chewing_KBStr2Num( char
return KB_DEFAULT;
}
@ -26,7 +39,7 @@ diff -up ./src/chewingio.c.phraseChoiceRearward ./src/chewingio.c
#endif
int addTerminateService( void (*callback)() )
@@ -103,7 +104,7 @@ int addTerminateService( void (*callback
@@ -103,7 +110,7 @@ int addTerminateService( void (*callback
CHEWING_API ChewingContext *chewing_new()
{
ChewingContext *ctx;
@ -35,7 +48,7 @@ diff -up ./src/chewingio.c.phraseChoiceRearward ./src/chewingio.c
ChewingData *internal_data = ALC( ChewingData, 1 );
ChewingOutput *internal_output = ALC( ChewingOutput, 1 );
ctx = ALC( ChewingContext, 1 );
@@ -159,7 +160,7 @@ CHEWING_API int chewing_Init(
@@ -159,7 +166,7 @@ CHEWING_API int chewing_Init(
dbg_path = FAILSAFE_OUTPUT;
fp_g = fopen( dbg_path, "w+" );
if ( ! fp_g ) {
@ -44,7 +57,7 @@ diff -up ./src/chewingio.c.phraseChoiceRearward ./src/chewingio.c
"Failed to record debug message in file.\n"
"--> Output to stderr\n" );
}
@@ -237,14 +238,14 @@ CHEWING_API void chewing_Terminate()
@@ -237,14 +244,14 @@ CHEWING_API void chewing_Terminate()
if ( TerminateServices[ i ] ) {
#ifdef ENABLE_DEBUG
/* Can't output to debug file because it's about to close */
@ -61,7 +74,7 @@ diff -up ./src/chewingio.c.phraseChoiceRearward ./src/chewingio.c
/* XXX: should check if the services are really completed. */
bTerminateCompleted = 1;
return;
@@ -403,7 +404,7 @@ CHEWING_API void chewing_set_ChiEngMode(
@@ -403,7 +410,7 @@ CHEWING_API void chewing_set_ChiEngMode(
ctx->data->bChiSym = ( mode == CHINESE_MODE ? 1 : 0 );
}
@ -70,7 +83,7 @@ diff -up ./src/chewingio.c.phraseChoiceRearward ./src/chewingio.c
{
return ctx->data->bChiSym;
}
@@ -413,7 +414,7 @@ CHEWING_API void chewing_set_ShapeMode(
@@ -413,7 +420,7 @@ CHEWING_API void chewing_set_ShapeMode(
ctx->data->bFullShape = (mode == FULLSHAPE_MODE ? 1 : 0);
}
@ -79,7 +92,7 @@ diff -up ./src/chewingio.c.phraseChoiceRearward ./src/chewingio.c
{
return ctx->data->bFullShape;
}
@@ -435,7 +436,7 @@ static int DoSelect( ChewingData *pgdata
@@ -435,7 +442,7 @@ static int DoSelect( ChewingData *pgdata
if ( pgdata->choiceInfo.isSymbol ) {
SymbolChoice( pgdata, num );
}
@ -88,16 +101,35 @@ diff -up ./src/chewingio.c.phraseChoiceRearward ./src/chewingio.c
/* change the select interval & selectStr & nSelect */
AddSelect( pgdata, num );
/* second, call choice module */
@@ -489,7 +490,7 @@ CHEWING_API int chewing_handle_Space( Ch
@@ -472,13 +479,13 @@ CHEWING_API int chewing_handle_Space( Ch
CheckAndResetRange( pgdata );
if ( pgdata->bSelect ) {
- if ( pgdata->choiceInfo.pageNo < ( pgdata->choiceInfo.nPage - 1 ) ) {
+ if ( pgdata->choiceInfo.pageNo < ( pgdata->choiceInfo.nPage - 1 ) ) {
return chewing_handle_Right( ctx );
}
}
if ( ! ChewingIsEntering( pgdata ) ) {
- if ( pgdata->bFullShape ) {
+ if ( pgdata->bFullShape ) {
rtn = FullShapeSymbolInput( ' ', pgdata );
}
else {
@@ -489,9 +496,9 @@ CHEWING_API int chewing_handle_Space( Ch
pgdata->chiSymbolBufLen = 0;
pgdata->chiSymbolCursor = 0;
keystrokeRtn = KEYSTROKE_COMMIT;
- }
+ }
else if ( pgdata->bChiSym != CHINESE_MODE ) {
/* see if buffer contains nothing */
- /* see if buffer contains nothing */
+ /* see if buffer contains nothing */
if ( pgdata->chiSymbolBufLen == 0 ) {
@@ -507,11 +508,11 @@ CHEWING_API int chewing_handle_Space( Ch
bQuickCommit = 1;
}
@@ -507,11 +514,11 @@ CHEWING_API int chewing_handle_Space( Ch
if ( rtn == SYMBOL_KEY_ERROR ) {
keystrokeRtn = KEYSTROKE_IGNORE;
/*
@ -111,7 +143,7 @@ diff -up ./src/chewingio.c.phraseChoiceRearward ./src/chewingio.c
else {
keystrokeRtn = KEYSTROKE_ABSORB;
}
@@ -524,9 +525,9 @@ CHEWING_API int chewing_handle_Space( Ch
@@ -524,9 +531,9 @@ CHEWING_API int chewing_handle_Space( Ch
/* Quick commit */
else {
DEBUG_OUT(
@ -123,7 +155,46 @@ diff -up ./src/chewingio.c.phraseChoiceRearward ./src/chewingio.c
pgo->nCommitStr = 1;
pgdata->chiSymbolBufLen = 0;
pgdata->chiSymbolCursor = 0;
@@ -643,7 +644,7 @@ CHEWING_API int chewing_handle_Enter( Ch
@@ -534,10 +541,11 @@ CHEWING_API int chewing_handle_Space( Ch
}
}
else {
+
rtn = ZuinPhoInput( &( pgdata->zuinData ), ' ' );
switch ( rtn ) {
case ZUIN_ABSORB:
- keystrokeRtn = KEYSTROKE_ABSORB;
+ keystrokeRtn = KEYSTROKE_ABSORB;
break;
case ZUIN_COMMIT:
AddChi( pgdata->zuinData.phone, pgdata );
@@ -557,10 +565,21 @@ CHEWING_API int chewing_handle_Space( Ch
toSelect = 1;
if ( toSelect ) {
- if ( ! pgdata->bSelect )
- ChoiceFirstAvail( pgdata );
- else
- ChoiceNextAvail( pgdata );
+ if( ! pgdata->bSelect ) {
+ cursor_orig=pgdata->chiSymbolCursor;
+ ChoiceFirstAvail( pgdata );
+ }
+ else {
+ if ( pgdata->config.bPhraseChoiceRearward ){
+ int avail_willbe=(pgdata->availInfo.currentAvail>0)?
+ pgdata->availInfo.currentAvail-1: pgdata->availInfo.nAvail - 1;
+ pgdata->chiSymbolCursor=cursor_orig - pgdata->availInfo.avail[avail_willbe].len;
+ if (chewing_buffer_Len(ctx)>cursor_orig){
+ pgdata->chiSymbolCursor++;
+ }
+ }
+ ChoiceNextAvail( pgdata );
+ }
}
else if ( pgdata->symbolKeyBuf[ key_buf_cursor ] ) {
/* Open Symbol Choice List */
@@ -643,7 +662,7 @@ CHEWING_API int chewing_handle_Enter( Ch
keystrokeRtn = KEYSTROKE_COMMIT;
WriteChiSymbolToBuf( pgo->commitStr, nCommitStr, pgdata );
AutoLearnPhrase( pgdata );
@ -132,7 +203,7 @@ diff -up ./src/chewingio.c.phraseChoiceRearward ./src/chewingio.c
pgo->nCommitStr = nCommitStr;
}
@@ -664,12 +665,12 @@ CHEWING_API int chewing_handle_Del( Chew
@@ -664,12 +683,12 @@ CHEWING_API int chewing_handle_Del( Chew
}
if ( ! pgdata->bSelect ) {
@ -149,7 +220,7 @@ diff -up ./src/chewingio.c.phraseChoiceRearward ./src/chewingio.c
NONDECREASE_CURSOR );
}
CallPhrasing( pgdata );
@@ -696,7 +697,7 @@ CHEWING_API int chewing_handle_Backspace
@@ -696,7 +715,7 @@ CHEWING_API int chewing_handle_Backspace
}
else if ( pgdata->chiSymbolCursor > 0 ) {
ChewingKillChar(
@ -158,7 +229,7 @@ diff -up ./src/chewingio.c.phraseChoiceRearward ./src/chewingio.c
pgdata->chiSymbolCursor - 1,
DECREASE_CURSOR );
}
@@ -735,11 +736,12 @@ CHEWING_API int chewing_handle_Up( Chewi
@@ -735,7 +754,7 @@ CHEWING_API int chewing_handle_Up( Chewi
CHEWING_API int chewing_handle_Down( ChewingContext *ctx )
{
@ -167,12 +238,7 @@ diff -up ./src/chewingio.c.phraseChoiceRearward ./src/chewingio.c
ChewingOutput *pgo = ctx->output;
int toSelect = 0;
int keystrokeRtn = KEYSTROKE_ABSORB;
int key_buf_cursor;
+ static int cursor_orig=-1;
CheckAndResetRange( pgdata );
@@ -756,13 +758,22 @@ CHEWING_API int chewing_handle_Down( Che
@@ -756,13 +775,22 @@ CHEWING_API int chewing_handle_Down( Che
toSelect = 1;
if ( toSelect ) {
@ -197,7 +263,7 @@ diff -up ./src/chewingio.c.phraseChoiceRearward ./src/chewingio.c
else if ( pgdata->symbolKeyBuf[ key_buf_cursor ] ) {
/* Open Symbol Choice List */
if ( ! pgdata->choiceInfo.isSymbol )
@@ -782,11 +793,11 @@ CHEWING_API int chewing_handle_ShiftLeft
@@ -782,11 +810,11 @@ CHEWING_API int chewing_handle_ShiftLeft
if ( ! ChewingIsEntering( pgdata ) ) {
keystrokeRtn = KEYSTROKE_IGNORE;
@ -212,7 +278,7 @@ diff -up ./src/chewingio.c.phraseChoiceRearward ./src/chewingio.c
pgdata->chiSymbolCursor > 0 &&
pgdata->PointEnd > -9 ) {
if ( pgdata->PointStart == -1 )
@@ -797,7 +808,7 @@ CHEWING_API int chewing_handle_ShiftLeft
@@ -797,7 +825,7 @@ CHEWING_API int chewing_handle_ShiftLeft
pgdata->PointEnd--;
}
if ( pgdata->PointEnd == 0 )
@ -221,7 +287,7 @@ diff -up ./src/chewingio.c.phraseChoiceRearward ./src/chewingio.c
}
}
@@ -822,8 +833,8 @@ CHEWING_API int chewing_handle_Left( Che
@@ -822,8 +850,8 @@ CHEWING_API int chewing_handle_Left( Che
pgdata->choiceInfo.pageNo = pgdata->choiceInfo.nPage - 1;
}
else {
@ -232,7 +298,7 @@ diff -up ./src/chewingio.c.phraseChoiceRearward ./src/chewingio.c
pgdata->chiSymbolCursor > 0 ) {
CheckAndResetRange( pgdata );
pgdata->chiSymbolCursor--;
@@ -842,13 +853,13 @@ CHEWING_API int chewing_handle_ShiftRigh
@@ -842,13 +870,13 @@ CHEWING_API int chewing_handle_ShiftRigh
if ( ! ChewingIsEntering( pgdata ) ) {
keystrokeRtn = KEYSTROKE_IGNORE;
@ -250,7 +316,7 @@ diff -up ./src/chewingio.c.phraseChoiceRearward ./src/chewingio.c
pgdata->PointEnd < 9 ) {
if ( pgdata->PointStart == -1 )
pgdata->PointStart = pgdata->chiSymbolCursor;
@@ -858,7 +869,7 @@ CHEWING_API int chewing_handle_ShiftRigh
@@ -858,7 +886,7 @@ CHEWING_API int chewing_handle_ShiftRigh
}
pgdata->chiSymbolCursor++;
if ( pgdata->PointEnd == 0 )
@ -259,7 +325,7 @@ diff -up ./src/chewingio.c.phraseChoiceRearward ./src/chewingio.c
}
}
@@ -883,9 +894,9 @@ CHEWING_API int chewing_handle_Right( Ch
@@ -883,9 +911,9 @@ CHEWING_API int chewing_handle_Right( Ch
pgdata->choiceInfo.pageNo = 0;
}
else {
@ -272,7 +338,7 @@ diff -up ./src/chewingio.c.phraseChoiceRearward ./src/chewingio.c
CheckAndResetRange( pgdata );
pgdata->chiSymbolCursor++;
}
@@ -974,11 +985,11 @@ CHEWING_API int chewing_handle_Home( Che
@@ -974,11 +1002,11 @@ CHEWING_API int chewing_handle_Home( Che
CheckAndResetRange( pgdata );
@ -287,7 +353,7 @@ diff -up ./src/chewingio.c.phraseChoiceRearward ./src/chewingio.c
}
MakeOutputWithRtn( pgo, pgdata, keystrokeRtn );
return 0;
@@ -993,12 +1004,12 @@ CHEWING_API int chewing_handle_End( Chew
@@ -993,12 +1021,12 @@ CHEWING_API int chewing_handle_End( Chew
CheckAndResetRange( pgdata );
if ( ! ChewingIsEntering( pgdata ) ) {
@ -305,7 +371,7 @@ diff -up ./src/chewingio.c.phraseChoiceRearward ./src/chewingio.c
return 0;
}
@@ -1013,9 +1024,9 @@ CHEWING_API int chewing_handle_PageUp( C
@@ -1013,9 +1041,9 @@ CHEWING_API int chewing_handle_PageUp( C
if ( ! ChewingIsEntering( pgdata ) ) {
keystrokeRtn = KEYSTROKE_IGNORE;
}
@ -317,7 +383,7 @@ diff -up ./src/chewingio.c.phraseChoiceRearward ./src/chewingio.c
MakeOutputWithRtn( pgo, pgdata, keystrokeRtn );
return 0;
}
@@ -1031,9 +1042,9 @@ CHEWING_API int chewing_handle_PageDown(
@@ -1031,9 +1059,9 @@ CHEWING_API int chewing_handle_PageDown(
if ( ! ChewingIsEntering( pgdata ) ) {
keystrokeRtn = KEYSTROKE_IGNORE;
}
@ -329,7 +395,7 @@ diff -up ./src/chewingio.c.phraseChoiceRearward ./src/chewingio.c
MakeOutputWithRtn( pgo, pgdata, keystrokeRtn );
return 0;
}
@@ -1107,7 +1118,7 @@ CHEWING_API int chewing_handle_Default(
@@ -1107,7 +1135,7 @@ CHEWING_API int chewing_handle_Default(
DoSelect( pgdata, num );
goto End_keyproc;
}
@ -338,7 +404,7 @@ diff -up ./src/chewingio.c.phraseChoiceRearward ./src/chewingio.c
/* Otherwise, use 'j' and 'k' for paging in selection mode */
DEBUG_OUT(
"\t\tchecking paging key, got '%c'\n",
@@ -1163,10 +1174,10 @@ CHEWING_API int chewing_handle_Default(
@@ -1163,10 +1191,10 @@ CHEWING_API int chewing_handle_Default(
rtn = ZuinPhoInput( &( pgdata->zuinData ), key );
DEBUG_OUT(
"\t\tChinese mode key, "
@ -351,7 +417,7 @@ diff -up ./src/chewingio.c.phraseChoiceRearward ./src/chewingio.c
if ( rtn == ZUIN_KEY_ERROR )
rtn = SpecialSymbolInput( key, pgdata );
switch ( rtn ) {
@@ -1182,14 +1193,14 @@ CHEWING_API int chewing_handle_Default(
@@ -1182,14 +1210,14 @@ CHEWING_API int chewing_handle_Default(
case ZUIN_KEY_ERROR:
case ZUIN_IGNORE:
DEBUG_OUT(
@ -369,7 +435,7 @@ diff -up ./src/chewingio.c.phraseChoiceRearward ./src/chewingio.c
key );
/* see if buffer contains nothing */
@@ -1207,7 +1218,7 @@ CHEWING_API int chewing_handle_Default(
@@ -1207,7 +1235,7 @@ CHEWING_API int chewing_handle_Default(
if ( rtn == SYMBOL_KEY_ERROR ) {
keystrokeRtn = KEYSTROKE_IGNORE;
/*
@ -378,7 +444,7 @@ diff -up ./src/chewingio.c.phraseChoiceRearward ./src/chewingio.c
* then it's wrong to commit it.
*/
bQuickCommit = 0;
@@ -1248,9 +1259,9 @@ End_keyproc:
@@ -1248,9 +1276,9 @@ End_keyproc:
/* Quick commit */
else {
DEBUG_OUT(
@ -390,7 +456,7 @@ diff -up ./src/chewingio.c.phraseChoiceRearward ./src/chewingio.c
pgo->nCommitStr = 1;
pgdata->chiSymbolBufLen = 0;
pgdata->chiSymbolCursor = 0;
@@ -1309,12 +1320,12 @@ CHEWING_API int chewing_handle_CtrlNum(
@@ -1309,12 +1337,12 @@ CHEWING_API int chewing_handle_CtrlNum(
cursor = PhoneSeqCursor( pgdata );
if ( ! pgdata->config.bAddPhraseForward ) {
@ -408,7 +474,7 @@ diff -up ./src/chewingio.c.phraseChoiceRearward ./src/chewingio.c
cursor + newPhraseLen - 1 ) ) {
/* Manually add phrase to the user phrase database. */
memcpy( addPhoneSeq,
@@ -1328,10 +1339,10 @@ CHEWING_API int chewing_handle_CtrlNum(
@@ -1328,10 +1356,10 @@ CHEWING_API int chewing_handle_CtrlNum(
phraseState = UserUpdatePhrase( addPhoneSeq, addWordSeq );
@ -423,7 +489,7 @@ diff -up ./src/chewingio.c.phraseChoiceRearward ./src/chewingio.c
phraseState );
/* Clear the breakpoint between the New Phrase */
@@ -1341,11 +1352,11 @@ CHEWING_API int chewing_handle_CtrlNum(
@@ -1341,11 +1369,11 @@ CHEWING_API int chewing_handle_CtrlNum(
}
}
else {
@ -439,7 +505,7 @@ diff -up ./src/chewingio.c.phraseChoiceRearward ./src/chewingio.c
cursor - newPhraseLen ) ) {
/* Manually add phrase to the user phrase database. */
memcpy( addPhoneSeq,
@@ -1358,10 +1369,10 @@ CHEWING_API int chewing_handle_CtrlNum(
@@ -1358,10 +1386,10 @@ CHEWING_API int chewing_handle_CtrlNum(
newPhraseLen, 1);
phraseState = UserUpdatePhrase( addPhoneSeq, addWordSeq );
@ -454,7 +520,7 @@ diff -up ./src/chewingio.c.phraseChoiceRearward ./src/chewingio.c
phraseState );
/* Clear the breakpoint between the New Phrase */
@@ -1414,10 +1425,10 @@ CHEWING_API int chewing_handle_Numlock(
@@ -1414,10 +1442,10 @@ CHEWING_API int chewing_handle_Numlock(
ChewingOutput *pgo = ctx->output;
int rtn, QuickCommit = 0;
int keystrokeRtn = KEYSTROKE_ABSORB;
@ -467,7 +533,7 @@ diff -up ./src/chewingio.c.phraseChoiceRearward ./src/chewingio.c
*/
if ( pgdata->chiSymbolBufLen == 0 ) {
QuickCommit = 1;
@@ -1428,7 +1439,7 @@ CHEWING_API int chewing_handle_Numlock(
@@ -1428,7 +1456,7 @@ CHEWING_API int chewing_handle_Numlock(
keystrokeRtn = KEYSTROKE_IGNORE ;
}
else if ( QuickCommit ) {
@ -476,7 +542,7 @@ diff -up ./src/chewingio.c.phraseChoiceRearward ./src/chewingio.c
pgo->nCommitStr = 1;
pgdata->chiSymbolBufLen = 0;
pgdata->chiSymbolCursor = 0;
@@ -1443,7 +1454,7 @@ CHEWING_API int chewing_handle_Numlock(
@@ -1443,7 +1471,7 @@ CHEWING_API int chewing_handle_Numlock(
else {
/* Otherwise, if we are selecting words, we use numeric keys
* as selkey
@ -487,7 +553,7 @@ diff -up ./src/chewingio.c.phraseChoiceRearward ./src/chewingio.c
if ( key > '0' && key < '9' )
diff -up ./src/choice.c.phraseChoiceRearward ./src/choice.c
--- ./src/choice.c.phraseChoiceRearward 2008-12-02 00:29:20.000000000 +1000
+++ ./src/choice.c 2009-07-31 17:16:57.000000000 +1000
+++ ./src/choice.c 2009-08-03 14:35:28.000000000 +1000
@@ -71,22 +71,44 @@ static void ChangeSelectIntervalAndBreak
}

@ -1,7 +1,7 @@
Name: libchewing
Version: 0.3.2
Release: 14%{?dist}
Release: 15%{?dist}
Summary: Intelligent phonetic input method library for Traditional Chinese
Group: System Environment/Libraries
@ -98,7 +98,11 @@ rm -rf $RPM_BUILD_ROOT
%{_libdir}/*.so
%changelog
* Tue Jul 30 2009 Ding-Yi Chen <dchen at redhat dot com> - 0.3.2-14
* Mon Aug 03 2009 Ding-Yi Chen <dchen at redhat dot com> - 0.3.2-15
- Fix [Bug 512108:issue 11] ibus-chewing crash the application
by move cursor_orig to chewingio.c global.
* Thu Jul 30 2009 Ding-Yi Chen <dchen at redhat dot com> - 0.3.2-14
- Fix [Bug 512108] ibus-chewing crash the application
* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3.2-13

Loading…
Cancel
Save