InputSystem icon indicating copy to clipboard operation
InputSystem copied to clipboard

Keyboard.onTextInput does not report delete

Open jackpr-unity opened this issue 8 years ago • 5 comments

Keyboard.onTextInput does not report the delete key. It does report the backspace key, so it should also report the delete key.

jackpr-unity avatar Feb 13 '18 17:02 jackpr-unity

Which OS? Windows?

Rene-Damm avatar Feb 14 '18 18:02 Rene-Damm

Hmm, thinking about this more, I'm not so sure. Report how? I assume you mean that it reports a Unicode backspace character for the backspace key and should report a Unicode delete character for the delete key?

I wonder whether representing editing operations as characters is a good idea. Both the backspace and the delete key depend on the current cursor position. It seems to me that editing keys (arrows, return, backspace, delete, home, end, etc) should be separate from the text input string.

Rene-Damm avatar Feb 14 '18 23:02 Rene-Damm

What is the purpose of onTextInput? My interpretation of it is "this reports printable characters." As a user, if I am interested in getting printable characters, I am probably also interested in getting both backspace and delete (maybe I am doing my own special textbox or something like that).

jackpr-unity avatar Feb 15 '18 00:02 jackpr-unity

Yup, that interpretation is correct. But backspace and delete are not printable characters :)

For doing your own text boxes, it would need to listen for editing keys like return etc. separately and perform the corresponding text edit operation.

Rene-Damm avatar Feb 15 '18 03:02 Rene-Damm

https://docs.unity3d.com/ScriptReference/Input-inputString.html

^ This function from the legacy input system seems to closely resemble onTextInput. It only reports printable characters, backspace, and newline (although the example also seems to handle carriage return...why?). Matching this function is good enough for me, through we could take this opportunity to expand functionality.

jackpr-unity avatar Feb 21 '18 00:02 jackpr-unity