Skip to content

libchewing

Suresoft-GLaDOS edited this page May 26, 2023 · 8 revisions

#1

Link : https://github.com/chewing/libchewing/commit/05bb0becd749510493273884a8262fe038fe5624
Description: Clean Bopomofo properly when switching Chi-Eng Mode

At src/chewingio.c

@@ -694,7 +694,8 @@ CHEWING_API void chewing_set_ChiEngMode(ChewingContext *ctx, int mode)
     if (mode == CHINESE_MODE || mode == SYMBOL_MODE) {
         // remove all data inside buffer as switching mode.
+        chewing_clean_bopomofo_buf(ctx);
-        BopomofoRemoveAll(&(ctx->data->bopomofoData));
-        MakeOutputWithRtn(ctx->output, ctx->data, KEYSTROKE_ABSORB);
         ctx->data->bChiSym = mode;
     }
 }

Tags
#Etc #Multi-line #Modified

#2

Link : https://github.com/chewing/libchewing/commit/6bd0906e262160a594388794606f563bb1e94e8f
Description: Clean Bopomofo properly when switching Chi-Eng Mode

At src/chewingio.c

@@ -694,7 +694,8 @@ CHEWING_API void chewing_set_ChiEngMode(ChewingContext *ctx, int mode)
     if (mode == CHINESE_MODE || mode == SYMBOL_MODE) {
         // remove all data inside buffer as switching mode.
+        chewing_clean_bopomofo_buf(ctx);
-        BopomofoRemoveAll(&(ctx->data->bopomofoData));
-        MakeOutputWithRtn(ctx->output, ctx->data, KEYSTROKE_ABSORB);
         ctx->data->bChiSym = mode;
     }
 }

Tags
#Etc #Multi-line #Modified

#3

Link : https://github.com/chewing/libchewing/commit/7bd9a439cbca5f176c178a460814a804de3fd55e
Description: Fix AutoLearnPhrase cannot fill correct wordSeq

At src/chewingutil.c

@@ -591,8 +591,8 @@ void AutoLearnPhrase( ChewingData *pgdata )
 {
 	uint16_t bufPhoneSeq[ MAX_PHONE_SEQ_LEN + 1 ];
 	char bufWordSeq[ MAX_PHONE_SEQ_LEN * MAX_UTF8_SIZE + 1 ] = { 0 };
+	char *pos;
 	int i, from, len;
-	int bufWordLen;
 	int prev_pos = 0;
 	int pending = 0;
@@ -603,9 +603,9 @@ void AutoLearnPhrase( ChewingData *pgdata )
 			memcpy( bufPhoneSeq + prev_pos, &pgdata->phoneSeq[ from ], sizeof( uint16_t ) * len );
 			bufPhoneSeq[ prev_pos + len ] = (uint16_t) 0;
+			pos = ueStrSeek( bufWordSeq, prev_pos );
-			bufWordLen = strlen( bufWordSeq );
 			copyStringFromPreeditBuf( pgdata, from, len,
+				pos, bufWordSeq + sizeof( bufWordSeq ) - pos );
-				bufWordSeq + bufWordLen, sizeof( bufWordSeq ) - bufWordLen );
 			prev_pos += len;
 			pending = 1;
 		}

Tags
#Logical-error #Multi-line #Modified

#4

Link : https://github.com/chewing/libchewing/commit/9dfe795a997caa38f85ab41a7f6c2ce68f9e5a8d
Description: Let up key close candidate list of symbols

At src/chewingio.c

@@ -1089,8 +1089,10 @@ CHEWING_API int chewing_handle_Up( ChewingContext *ctx )
 		key_buf_cursor--;
 	/* close candidate list, compared to Down key to open candidate list. */
+	if ( pgdata->bSelect ) {
+		ChoiceEndChoice( pgdata );
-	if ( ! pgdata->symbolKeyBuf[ key_buf_cursor ] ) {
-		if ( pgdata->bSelect ) {
-			ChoiceEndChoice( pgdata );
-		}
 	}
 	MakeOutputWithRtn( pgo, pgdata, keystrokeRtn );

Tags
#Invalid-condition #Multi-line #Modified

#5

Link : https://github.com/chewing/libchewing/commit/13bc5e379857238483662c9480e41b6056a183b3
Description: Toggle shape mode with shift-space

At src/chewingio.c

@@ -1728,7 +1728,6 @@ CHEWING_API int chewing_handle_ShiftSpace(ChewingContext *ctx)
         CheckAndResetRange(pgdata);
     }
+    chewing_set_ShapeMode(ctx, 1 - chewing_get_ShapeMode(ctx));
     CallPhrasing(pgdata, 0);
     MakeOutputWithRtn(pgo, pgdata, keystrokeRtn);

Tags
#Etc #Single-line #Added

#6

Link : https://github.com/chewing/libchewing/commit/634b4f5b03a803be176a336377638b31ebcf876e
Description: Fix numlock key cannot output number

At src/chewingutil.c

@@ -542,7 +542,7 @@ int ReleaseChiSymbolBuf( ChewingData *pgdata, ChewingOutput *pgo )
 	throwEnd = CountReleaseNum( pgdata );
+	pgo->nCommitStr += throwEnd;
-	pgo->nCommitStr = throwEnd;
 	if ( throwEnd ) {
 		/*
 		 * count how many chinese words in "chiSymbolBuf[ 0 .. (throwEnd - 1)]"

Tags
#Logical-error #Single-line #Modified

#7

Link : https://github.com/chewing/libchewing/commit/e02be85210c22650c298ceddb8b3d629846d4a88
Description: Fix jk_selection

At src/chewingutil.c

@@ -729,7 +729,7 @@ int CallPhrasing(ChewingData *pgdata, int all_phrasing)
             ch_count++;
         else {
             pgdata->bArrBrkpt[ch_count] = 1;
+            pgdata->bSymbolArrBrkpt[i] = 1;
-            pgdata->bSymbolArrBrkpt[ch_count] = 1;
         }
     }

Tags
#Logical-error #Single-line #Modified

#8

Link : https://github.com/chewing/libchewing/commit/eb65402015d71808c474a3c76d6f5f2aa4f7a379
Description: Fix cannot handle numlock 9 correctly

At src/chewingio.c

@@ -1383,7 +1383,7 @@ CHEWING_API int chewing_handle_Numlock( ChewingContext *ctx, int key )
 		 * and submit the words.
 		 */
 		int num = -1;
+		if ( key > '0' && key <= '9' )
-		if ( key > '0' && key < '9' )
 			num = key - '1';
 		else if ( key == '0' )
 			num = 9;

Tags
#Invalid-condition #Single-line #Modified

Clone this wiki locally