Improve GUI text field

The previously very basic implementation of the text field component was
greatly improved in many different aspects, so that it should now behave
exactly like a native OS text field. The changes include:
- Overflowing text is not shown.
- There is a caret that can be moved and hence changing the insertion
location is possible.
- Text can be selected, both with the mouse and the keyboard. The
selected text can be copied or cut out.
- Pasting text is possible as well.
- Every text that is entered is sanitized so that control characters and
newlines are removed.