Skip to content

Commit

Permalink
Toggle space mode with shift-space
Browse files Browse the repository at this point in the history
This should fix chewing#141
  • Loading branch information
hiunnhue committed Apr 4, 2014
1 parent b7fbb78 commit 203b861
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/chewingio.c
Expand Up @@ -1727,6 +1727,9 @@ CHEWING_API int chewing_handle_ShiftSpace(ChewingContext *ctx)
if (!pgdata->bSelect) {
CheckAndResetRange(pgdata);
}

chewing_set_ShapeMode(ctx, 1 - chewing_get_ShapeMode(ctx));

CallPhrasing(pgdata, 0);
MakeOutputWithRtn(pgo, pgdata, keystrokeRtn);
return 0;
Expand Down
22 changes: 21 additions & 1 deletion test/test-bopomofo.c
Expand Up @@ -1015,7 +1015,27 @@ void test_PageDown()

void test_ShiftSpace()
{
/* FIXME: Implement this. */
ChewingContext *ctx;
int mode;

ctx = chewing_new();
start_testcase(ctx, fd);

mode = chewing_get_ShapeMode(ctx);
ok(mode == HALFSHAPE_MODE, "mode shall be HALFSHAPE_MODE");

type_keystroke_by_string(ctx, "<SS>");
mode = chewing_get_ShapeMode(ctx);
ok(mode == FULLSHAPE_MODE, "mode shall be FULLSHAPE_MODE");

type_keystroke_by_string(ctx, " ");
ok_commit_buffer(ctx, "\xE3\x80\x80"); /* Fullshape Space (U+3000) */

chewing_set_ChiEngMode(ctx, SYMBOL_MODE);
type_keystroke_by_string(ctx, "a");
ok_commit_buffer(ctx, "\xEF\xBD\x81"); /* Fullshape a */

chewing_delete(ctx);
}

void test_Numlock_numeric_input()
Expand Down

0 comments on commit 203b861

Please sign in to comment.