Skip to content

Commit

Permalink
Fix buffer checkings (#21)
Browse files Browse the repository at this point in the history
Signed-off-by: Hui-Hong You <[email protected]>
  • Loading branch information
hiroshiyui authored Jun 12, 2024
1 parent 1920860 commit a9c1b79
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/eim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -468,22 +468,26 @@ void ChewingEngine::keyEvent(const InputMethodEntry &entry,
chewing_handle_Default(ctx, scan_code);
chewing_set_easySymbolInput(ctx, 0);
} else if (keyEvent.key().check(FcitxKey_BackSpace)) {
if (chewing_buffer_Check(ctx) && chewing_bopomofo_Check(ctx)) {
if ((chewing_buffer_Check(ctx)) == 0 &&
(chewing_bopomofo_Check(ctx) == 0)) {
return;
}
chewing_handle_Backspace(ctx);
if (chewing_buffer_Check(ctx) && chewing_bopomofo_Check(ctx)) {
if ((chewing_buffer_Check(ctx)) == 0 &&
(chewing_bopomofo_Check(ctx) == 0)) {
keyEvent.filterAndAccept();
return reset(entry, keyEvent);
}
} else if (keyEvent.key().check(FcitxKey_Escape)) {
chewing_handle_Esc(ctx);
} else if (keyEvent.key().check(FcitxKey_Delete)) {
if (chewing_buffer_Check(ctx) && chewing_bopomofo_Check(ctx)) {
if ((chewing_buffer_Check(ctx)) == 0 &&
(chewing_bopomofo_Check(ctx) == 0)) {
return;
}
chewing_handle_Del(ctx);
if (chewing_buffer_Check(ctx) && chewing_bopomofo_Check(ctx)) {
if ((chewing_buffer_Check(ctx)) == 0 &&
(chewing_bopomofo_Check(ctx) == 0)) {
keyEvent.filterAndAccept();
return reset(entry, keyEvent);
}
Expand Down

0 comments on commit a9c1b79

Please sign in to comment.