rpms/libchewing/devel libchewing-0.3.2.phraseChoiceRearward, NONE, 1.1 import.log, 1.9, 1.10 libchewing.spec, 1.31, 1.32

Ding-Yi Chen dchen at fedoraproject.org
Tue May 19 07:59:46 UTC 2009


Author: dchen

Update of /cvs/pkgs/rpms/libchewing/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv27393/devel

Modified Files:
	import.log libchewing.spec 
Added Files:
	libchewing-0.3.2.phraseChoiceRearward 
Log Message:
Fix phraseChooseRearward


--- NEW FILE libchewing-0.3.2.phraseChoiceRearward ---
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 );


Index: import.log
===================================================================
RCS file: /cvs/pkgs/rpms/libchewing/devel/import.log,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -p -r1.9 -r1.10
--- import.log	22 Apr 2009 04:51:33 -0000	1.9
+++ import.log	19 May 2009 07:59:16 -0000	1.10
@@ -7,3 +7,4 @@ libchewing-0_3_2-3_fc10:HEAD:libchewing-
 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-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


Index: libchewing.spec
===================================================================
RCS file: /cvs/pkgs/rpms/libchewing/devel/libchewing.spec,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -p -r1.31 -r1.32
--- libchewing.spec	22 Apr 2009 04:51:33 -0000	1.31
+++ libchewing.spec	19 May 2009 07:59:16 -0000	1.32
@@ -1,7 +1,7 @@
 
 Name:           libchewing
 Version:        0.3.2
-Release:        8%{?dist}
+Release:        9%{?dist}
 Summary:        Intelligent phonetic input method library for Traditional Chinese
 
 Group:          System Environment/Libraries
@@ -18,6 +18,7 @@ Source:         http://chewing.csie.net/
 #Patch7: libchewing-0.3.0-9.bz200694.patch
 #Patch8: libchewing-0.3.0-11.bz195416.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)")}
 %define libchewing_python_dir %{python_sitearch}/%{name}
@@ -55,6 +56,7 @@ library.
 #%patch7 -p1 -b .8-bz200694
 #%patch8 -p1 -b .9-bz195416
 %patch9 -p0 -b .bz477690
+%patch10 -p0 -b .phraseChoiceRearward
 
 %build
 #./autogen.sh
@@ -97,6 +99,10 @@ rm -rf $RPM_BUILD_ROOT
 %{_libdir}/*.so
 
 %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
 - Fix [Bug 496968] - libchewing-debuginfo does not contain sources.
 




More information about the scm-commits mailing list