Skip to content

Commit d44e39a

Browse files
authored
Merge pull request #39 from ray2501/master
Handle space and apostrophe in full width mode
2 parents a83d986 + a744941 commit d44e39a

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

src/engine.c

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -622,14 +622,33 @@ static gboolean ibus_array_engine_process_key_event (IBusEngine *engine, guint
622622

623623
switch (keyval) {
624624
case IBUS_space:
625-
if (arrayeng->preedit->len == 0)
625+
if (arrayeng->preedit->len == 0) {
626+
if (is_fullwidth_mode) {
627+
if (keyval >= 32 && keyval - 32 < sizeof(sFullWidthTable)) {
628+
IBusText* newtext = ibus_text_new_from_string(sFullWidthTable[keyval - 32]);
629+
ibus_engine_commit_text((IBusEngine*)arrayeng, newtext);
630+
return TRUE;
631+
}
632+
}
633+
626634
return FALSE;
635+
}
636+
627637
ibus_array_engine_space_press(arrayeng);
628638
return TRUE;
629639

630640
case IBUS_apostrophe:
631-
if (arrayeng->preedit->len == 0)
641+
if (arrayeng->preedit->len == 0) {
642+
if (is_fullwidth_mode) {
643+
if (keyval >= 32 && keyval - 32 < sizeof(sFullWidthTable)) {
644+
IBusText* newtext = ibus_text_new_from_string(sFullWidthTable[keyval - 32]);
645+
ibus_engine_commit_text((IBusEngine*)arrayeng, newtext);
646+
return TRUE;
647+
}
648+
}
649+
632650
return FALSE;
651+
}
633652

634653
/* The behavior of phrase key is like space key first time */
635654
if (arrayeng->space_press_count == 0) {

0 commit comments

Comments
 (0)