Extract sdl keycode to curses key into a separate function

sdl_keycode_to_curses: add support for function keys and numpad keys.

Also add delete key to the wrapped keys from SDL to ncurses.
make the alt+numpad code a bit simpler
Replace lastchar_isbutton, lastchar and lastchar_is_mouse with a single input_event

It contains all the possible input types (those that the input manager understands).
The previous implementation used some magic combination of the two booleans and lastchar to determine the input type.
This is now done directly at the input.

It also handles UTF8-strings coming from SDL. SDL reports input as UTF-8 string. The previous implementation would only copy the very first byte from that string and return that via getch().
All the other bytes of the UTF-8 were lost. This is now fixed and compatible with curses. Curses returns a single UTF-8 character via several calls to getch, same does the SDL wrapper now.

Instead of creating the input_event in input_manager::get_input_event, it is now created in the actual input functions, which are specific to the input type.
Note that input_event is automatically initialized as type ERROR.

ALT+number sequences in SDL_TEXTINPUT are interpreted as decimal value
of a UNICODE code point and converted to an UTF-8 sequence, which is
than commited the same way as input from SDL_TEXTINPUT is.
Add utf8_wrapper class to handle utf8 strings nicely.

Basically a utf8 string stuffed into a std::string. But note that std::string may report a length of 6 chars, while the utf8-string is actually only 2 unicode characters long. This class handles this.
Add function read sequence of utf-8 bytes with getch

This reads the UTF-8 encoded bytes (each call to getch returns a single byte of an UTF-8 encoded character) and stores them in a utf8_wrapper.
The function also handles the cursor position in the current strings and some special keys (HOME,END,DELETE,BACKSPACE).

Use that function in string_input_win, new world name, new character name.

Fix a display bug in string_input_win: consider the underscore of the cursor at the end of the input for shifting.
Display UTF-8 character (not bytes!) individually by splitting with utf8_wrapper.
Rewrite printing the current input in the string input function.

This avoid some pitfalls with UTF-8 by:
1. clearing the line
2. printing the (visible part of the) input string (using utf8_wrapper::substr to remove the part that is scrolled out of view).
3. printing the cursor (in special color), possibly overriding the already printed strings.
4. printing the trailing newlines.
Move code to get a UTF-8 sequence from input into the input manager.

For the ncurses version this moves the code of utf8_wrapper::insert_from_getch into the input manager. For the SDL version the SDL-event already provides a UTF-8 sequence which is simply used. The previously needed wrapper (commit_next_utf8_byte) can be omitted.

This adds a new member to input_event: the (UTf-8 encoded) text that was entered.
Code that needs textual input (as opposed to only a single keystroke) will use that member.

string_input_win: fix display bugs to properly display multi-cell characters.

is_char_allowed: check with std::isprint, allow any non-ascii Unicode character, disallow slash and backslash as they are path separators.
Merge remote-tracking branch 'dda/pr/8041' into dda-master

* dda/pr/8041:
  Move code to get a UTF-8 sequence from input into the input manager.
  Rewrite printing the current input in the string input function.
  Add function read sequence of utf-8 bytes with getch
  Add utf8_wrapper class to handle utf8 strings nicely.
  Replace lastchar_isbutton, lastchar and lastchar_is_mouse with a single input_event
  make the alt+numpad code a bit simpler
  Extract sdl keycode to curses key into a separate function