[PATCH 2/4] keyboard: Allow backspace for pre-edit text

Jan Arne Petersen jpetersen at openismus.com
Tue Sep 18 02:06:58 PDT 2012


On 09/18/2012 02:29 AM, Bill Spitzak wrote:
> I feel it would be better to confirm the pre-edit at this point, then
> send the backspace to the application.

With a virtual keyboard one usually keeps the current word in the
composing (pre-edit) state (to allow correction/prediction). I do not
think committing would be the right strategy in this case.

> On 09/17/2012 06:28 AM, Jan Arne Petersen wrote:
>> From: Jan Arne Petersen <jpetersen at openismus.com>
>>
>> When there is a pre-edit text delete the last character of the pre-edit
>> text with the backspace key.
>> ---
>>   clients/keyboard.c | 5 +++++
>>   1 file changed, 5 insertions(+)
>>
>> diff --git a/clients/keyboard.c b/clients/keyboard.c
>> index bf0e9f0..8820a22 100644
>> --- a/clients/keyboard.c
>> +++ b/clients/keyboard.c
>> @@ -233,6 +233,11 @@ keyboard_handle_key(struct keyboard *keyboard,
>> const struct key *key)
>>               if (strlen(keyboard->keyboard->preedit_string) == 0) {
>>                  
>> input_method_context_delete_surrounding_text(keyboard->keyboard->context,
>>                                            -1, 1);
>> +            } else {
>> +               
>> keyboard->keyboard->preedit_string[strlen(keyboard->keyboard->preedit_string)
>> - 1] = '\0';
>> +               
>> input_method_context_preedit_string(keyboard->keyboard->context,
>> +                                    keyboard->keyboard->preedit_string,
>> +                                   
>> strlen(keyboard->keyboard->preedit_string));
>>               }
>>               break;
>>           case keytype_enter:
>>
> 
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel



More information about the wayland-devel mailing list