Fix phraseChooseRearward

epel9
Ding-Yi Chen 16 years ago
parent dfcb414a5e
commit 42340c0421

@ -7,3 +7,4 @@ libchewing-0_3_2-3_fc10:HEAD:libchewing-0.3.2-3.fc10.src.rpm:1231914268
libchewing-0_3_2-4_fc10:HEAD:libchewing-0.3.2-4.fc10.src.rpm:1232696067 libchewing-0_3_2-4_fc10:HEAD:libchewing-0.3.2-4.fc10.src.rpm:1232696067
libchewing-0_3_2-6_fc10:HEAD:libchewing-0.3.2-6.fc10.src.rpm:1235113283 libchewing-0_3_2-6_fc10:HEAD:libchewing-0.3.2-6.fc10.src.rpm:1235113283
libchewing-0_3_2-8_fc10:HEAD:libchewing-0.3.2-8.fc10.src.rpm:1240375796 libchewing-0_3_2-8_fc10:HEAD:libchewing-0.3.2-8.fc10.src.rpm:1240375796
libchewing-0_3_2-9_fc11:HEAD:libchewing-0.3.2-9.fc11.src.rpm:1242719923

@ -0,0 +1,111 @@
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-05-18 18:02:15.000000000 +1000
@@ -740,6 +740,7 @@ CHEWING_API int chewing_handle_Down( Che
int toSelect = 0;
int keystrokeRtn = KEYSTROKE_ABSORB;
int key_buf_cursor;
+ static int cursor_last=-1;
CheckAndResetRange( pgdata );
@@ -757,9 +758,15 @@ CHEWING_API int chewing_handle_Down( Che
if ( toSelect ) {
if( ! pgdata->bSelect ) {
+ cursor_last=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_last -pgdata->availInfo.avail[avail_willbe].len;
+ }
ChoiceNextAvail( pgdata );
}
}
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-05-18 17:56:32.000000000 +1000
@@ -73,20 +73,42 @@ static void ChangeSelectIntervalAndBreak
/** @brief Loading all possible phrases after the cursor from long to short into AvailInfo structure.*/
static void SetAvailInfo(
AvailInfo *pai, const uint16 phoneSeq[],
- int nPhoneSeq, int begin, const int bSymbolArrBrkpt[] )
+ int nPhoneSeq, int begin, const int bSymbolArrBrkpt[],
+ ChewingData *pgdata)
{
int end, pho_id;
int diff;
uint16 userPhoneSeq[ MAX_PHONE_SEQ_LEN ];
pai->nAvail = 0;
+
+ int i,head,head_tmp;
+ if ( pgdata->config.bPhraseChoiceRearward ){
+ for (i=nPhoneSeq-1;i>=begin;i--){
+ head=i;
+ if(bSymbolArrBrkpt[i])
+ break;
+ }
+ head_tmp=nPhoneSeq-1;
+ }else{
+ head_tmp=head=begin;
+ }
- for ( end = begin; end < nPhoneSeq; end++ ) {
- diff = end - begin;
- if ( diff > 0 && bSymbolArrBrkpt[ end ] )
- break;
+ int tail,tail_tmp;
+ if ( pgdata->config.bPhraseChoiceRearward ){
+ tail_tmp=tail=nPhoneSeq-1;
+ }else{
+ for (i=begin;i<nPhoneSeq;i++){
+ if(bSymbolArrBrkpt[i])
+ break;
+ tail=i;
+ }
+ tail_tmp=begin;
+ }
- pho_id = TreeFindPhrase( begin, end, phoneSeq );
+ while(head<=head_tmp && tail_tmp>=tail){
+ diff = tail_tmp - head_tmp;
+ pho_id = TreeFindPhrase( head_tmp, tail_tmp, phoneSeq );
if ( pho_id != -1 ) {
/* save it! */
pai->avail[ pai->nAvail ].len = diff + 1;
@@ -96,7 +118,7 @@ static void SetAvailInfo(
else {
memcpy(
userPhoneSeq,
- &phoneSeq[ begin ],
+ &phoneSeq[ head_tmp ],
sizeof( uint16 ) * ( diff + 1 ) ) ;
userPhoneSeq[ diff + 1 ] = 0;
if ( UserGetPhraseFirst( userPhoneSeq ) ) {
@@ -109,6 +131,12 @@ static void SetAvailInfo(
pai->avail[ pai->nAvail ].id = -1;
}
}
+
+ if ( pgdata->config.bPhraseChoiceRearward ){
+ head_tmp--;
+ }else{
+ tail_tmp++;
+ }
}
}
@@ -229,7 +257,8 @@ int ChoiceFirstAvail( ChewingData *pgdat
pgdata->phoneSeq,
pgdata->nPhoneSeq,
PhoneSeqCursor( pgdata ),
- pgdata->bSymbolArrBrkpt );
+ pgdata->bSymbolArrBrkpt,
+ pgdata);
if ( ! pgdata->availInfo.nAvail )
return ChoiceEndChoice( pgdata );

@ -1,7 +1,7 @@
Name: libchewing Name: libchewing
Version: 0.3.2 Version: 0.3.2
Release: 8%{?dist} Release: 9%{?dist}
Summary: Intelligent phonetic input method library for Traditional Chinese Summary: Intelligent phonetic input method library for Traditional Chinese
Group: System Environment/Libraries Group: System Environment/Libraries
@ -18,6 +18,7 @@ Source: http://chewing.csie.net/download/libchewing/%{name}-%{version}.t
#Patch7: libchewing-0.3.0-9.bz200694.patch #Patch7: libchewing-0.3.0-9.bz200694.patch
#Patch8: libchewing-0.3.0-11.bz195416.patch #Patch8: libchewing-0.3.0-11.bz195416.patch
Patch9: libchewing-0.3.2.bz477690.patch Patch9: libchewing-0.3.2.bz477690.patch
Patch10: libchewing-0.3.2.phraseChoiceRearward
%{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")} %{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
%define libchewing_python_dir %{python_sitearch}/%{name} %define libchewing_python_dir %{python_sitearch}/%{name}
@ -55,6 +56,7 @@ library.
#%patch7 -p1 -b .8-bz200694 #%patch7 -p1 -b .8-bz200694
#%patch8 -p1 -b .9-bz195416 #%patch8 -p1 -b .9-bz195416
%patch9 -p0 -b .bz477690 %patch9 -p0 -b .bz477690
%patch10 -p0 -b .phraseChoiceRearward
%build %build
#./autogen.sh #./autogen.sh
@ -97,6 +99,10 @@ rm -rf $RPM_BUILD_ROOT
%{_libdir}/*.so %{_libdir}/*.so
%changelog %changelog
* Mon May 18 2009 Ding-Yi Chen <dchen at redhat dot com> - 0.3.2-9
- Possible Fix of Bug 501220 - RFE: edit last preedit character from end of line
Chewing upstream does not handle if phrase choice rearward is enabled.
* Wed Apr 22 2009 Ding-Yi Chen <dchen at redhat dot com> - 0.3.2-8 * Wed Apr 22 2009 Ding-Yi Chen <dchen at redhat dot com> - 0.3.2-8
- Fix [Bug 496968] - libchewing-debuginfo does not contain sources. - Fix [Bug 496968] - libchewing-debuginfo does not contain sources.

Loading…
Cancel
Save