Use is_composing() instead of raw ime_in_progress_
This commit is contained in:
parent
5e22b2b714
commit
6212a62a98
1 changed files with 7 additions and 7 deletions
|
@ -160,7 +160,7 @@ void text_box_base::insert_char(const utf8::string& unicode)
|
|||
|
||||
size_t text_box_base::get_composition_length() const
|
||||
{
|
||||
if(!ime_in_progress_) {
|
||||
if(!is_composing()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -384,7 +384,7 @@ void text_box_base::handle_key_backspace(SDL_Keymod /*modifier*/, bool& handled)
|
|||
delete_selection();
|
||||
} else if(selection_start_) {
|
||||
delete_char(true);
|
||||
if(ime_in_progress_) {
|
||||
if(is_composing()) {
|
||||
if(get_composition_length() == 0) {
|
||||
ime_in_progress_ = false;
|
||||
}
|
||||
|
@ -402,7 +402,7 @@ void text_box_base::handle_key_delete(SDL_Keymod /*modifier*/, bool& handled)
|
|||
delete_selection();
|
||||
} else if(selection_start_ < text_.get_length()) {
|
||||
delete_char(false);
|
||||
if(ime_in_progress_) {
|
||||
if(is_composing()) {
|
||||
if(get_composition_length() == 0) {
|
||||
ime_in_progress_ = false;
|
||||
}
|
||||
|
@ -417,7 +417,7 @@ void text_box_base::handle_commit(bool& handled, const utf8::string& unicode)
|
|||
|
||||
if(unicode.size() > 1 || unicode[0] != 0) {
|
||||
handled = true;
|
||||
if(ime_in_progress_) {
|
||||
if(is_composing()) {
|
||||
set_selection(ime_start_point_ + get_composition_length(), 0);
|
||||
ime_in_progress_ = false;
|
||||
} else {
|
||||
|
@ -436,7 +436,7 @@ void text_box_base::handle_editing(bool& handled, const utf8::string& unicode, i
|
|||
if(unicode.size() > 1 || unicode[0] != 0) {
|
||||
handled = true;
|
||||
std::size_t new_len = utf8::size(unicode);
|
||||
if(!ime_in_progress_) {
|
||||
if(!is_composing()) {
|
||||
ime_in_progress_ = true;
|
||||
delete_selection();
|
||||
ime_start_point_ = selection_start_;
|
||||
|
@ -596,7 +596,7 @@ void text_box_base::signal_handler_sdl_key_down(const event::ui_event event,
|
|||
|
||||
case SDLK_RETURN:
|
||||
case SDLK_KP_ENTER:
|
||||
if(!ime_in_progress_ || (modifier & (KMOD_CTRL | KMOD_ALT | KMOD_GUI | KMOD_SHIFT))) {
|
||||
if(!is_composing() || (modifier & (KMOD_CTRL | KMOD_ALT | KMOD_GUI | KMOD_SHIFT))) {
|
||||
return;
|
||||
}
|
||||
// The IME will handle it, we just need to make sure nothing else handles it too.
|
||||
|
@ -604,7 +604,7 @@ void text_box_base::signal_handler_sdl_key_down(const event::ui_event event,
|
|||
break;
|
||||
|
||||
case SDLK_ESCAPE:
|
||||
if(!ime_in_progress_ || (modifier & (KMOD_CTRL | KMOD_ALT | KMOD_GUI | KMOD_SHIFT))) {
|
||||
if(!is_composing() || (modifier & (KMOD_CTRL | KMOD_ALT | KMOD_GUI | KMOD_SHIFT))) {
|
||||
return;
|
||||
}
|
||||
interrupt_composition();
|
||||
|
|
Loading…
Add table
Reference in a new issue