@@ -303,43 +303,11 @@ void TextInputChannel::SendStateUpdate() {
303303bool TextInputChannel::HandleKey (const char * key,
304304 const char * string,
305305 uint32_t modifires) {
306- bool shift = modifires & ECORE_SHIFT;
307306 bool needs_update = false ;
308307 std::string key_str = key;
309308
310- if (key_str == " Left" ) {
311- if (shift) {
312- TextRange selection = active_model_->selection ();
313- needs_update = active_model_->SetSelection (
314- TextRange (selection.base (), selection.extent () - 1 ));
315- } else {
316- needs_update = active_model_->MoveCursorBack ();
317- }
318- } else if (key_str == " Right" ) {
319- if (shift) {
320- TextRange selection = active_model_->selection ();
321- needs_update = active_model_->SetSelection (
322- TextRange (selection.base (), selection.extent () + 1 ));
323- } else {
324- needs_update = active_model_->MoveCursorForward ();
325- }
326- } else if (key_str == " End" ) {
327- if (shift) {
328- needs_update = active_model_->SelectToEnd ();
329- } else {
330- needs_update = active_model_->MoveCursorToEnd ();
331- }
332- } else if (key_str == " Home" ) {
333- if (shift) {
334- needs_update = active_model_->SelectToBeginning ();
335- } else {
336- needs_update = active_model_->MoveCursorToBeginning ();
337- }
338- } else if (key_str == " BackSpace" ) {
339- needs_update = active_model_->Backspace ();
340- } else if (key_str == " Delete" ) {
341- needs_update = active_model_->Delete ();
342- } else if (string && strlen (string) == 1 && IsAsciiPrintableKey (string[0 ])) {
309+ if (string && strlen (string) == 1 && IsAsciiPrintableKey (string[0 ])) {
310+ // This is a fallback for printable keys not handled by IMF.
343311 active_model_->AddCodePoint (string[0 ]);
344312 needs_update = true ;
345313 } else if (key_str == " Return" ) {
0 commit comments