#6 Improve input element

Open
132ikl wants to merge 1 commits from 132ikl/master into pgimeno/master
132ikl commented 5 years ago

Adds automatic selection of end of line when focusing an input element and the option to delete everything from the cursor to the beginning of the input element with ctrl+backspace. Normally ctrl+backspace deletes everything but symbols, but I decided to just have it delete to the beginning.

Adds automatic selection of end of line when focusing an input element and the option to delete everything from the cursor to the beginning of the input element with ctrl+backspace. Normally ctrl+backspace deletes everything but symbols, but I decided to just have it delete to the beginning.
Pedro Gimeno commented 5 years ago
Owner

I agree on moving the cursor to end when focusing the element, but not on the ctrl+backspace action. Changing the meaning of a standard key binding can confuse users, and ctrl+backspace should be "delete word".

The input element does not handle selection currently. The issue that this PR attempts to address can be better fixed when selection is implemented. But until then, a rough emulation is acceptable.

The rough emulation I have in mind is to set a flag when the control is focused; the flag's meaning would be "delete everything on the next input". It would work as follows:

  • On focus, the flag would be set.
  • An arrow key or the home/end keys would just clear the flag.
  • The Ctrl, Shift, Alt, Tab, Enter keys would not affect the flag. Maybe there are more.
  • Any other key would first check if the flag is set. If it is, the previous contents of the field would be erased before performing the action associated with the key, then the flag would be reset.
I agree on moving the cursor to end when focusing the element, but not on the ctrl+backspace action. Changing the meaning of a standard key binding can confuse users, and ctrl+backspace should be "delete word". The input element does not handle selection currently. The issue that this PR attempts to address can be better fixed when selection is implemented. But until then, a rough emulation is acceptable. The rough emulation I have in mind is to set a flag when the control is focused; the flag's meaning would be "delete everything on the next input". It would work as follows: - On focus, the flag would be set. - An arrow key or the home/end keys would just clear the flag. - The Ctrl, Shift, Alt, Tab, Enter keys would not affect the flag. Maybe there are more. - Any other key would first check if the flag is set. If it is, the previous contents of the field would be erased before performing the action associated with the key, then the flag would be reset.
132ikl commented 5 years ago
Poster

I agree that Ctrl+Backspace should be delete word, I just needed something quick for my own purposes. It should be that hard to add the delete word functionality but I won't have time to do it for a couple of days, just thought I was would PR my changes if you thought they were useful.

I agree that Ctrl+Backspace *should* be delete word, I just needed something quick for my own purposes. It should be that hard to add the delete word functionality but I won't have time to do it for a couple of days, just thought I was would PR my changes if you thought they were useful.
This pull request can be merged automatically.
Sign in to join this conversation.
No Milestone
No assignee
2 Participants
Loading...
Cancel
Save
There is no content yet.