Remove useless tinythread import in PlugLoad-windows.cpp
Remove seemingly useless tinythread import in LuaTools.cpp
Factor out tinythread in LuaApi.cpp
Removed unused tinythread in LuaWrapper.cpp
Removed unused tinythread include in LuaTypes.cpp
Removed unused tinythread include in ColorText.cpp
Factor out tinythread in Console.h
Factor out tinythread in Console-posix.cpp
Factor out tinythread in Console-windows.cpp
Factor out tinythread in renderer_light
Factor out tinythread in DataDefs.cpp
Remove unused tinythread include in RemoteClient.cpp
Add includes for new mutex and conditional_variable usages in PluginManager
Factor out tinythread from devel/memview, renderermax/renderer_light, and rendermax/renderer_opengl plugins
Remove usages of tinythread in various CMakeLists.txt files, in .ycm_extra_conf.py, and delete tinythread itself
Delete tinythread from LISCENSE.rst
excise tinythread: fix deadlock in pluginmanager
excise tinythread: remove improper header
excise tinythread: fix double unlock. fix plugin typo
Before, calling `dfhack.run_command('tiletypes')` from a `dfhack.timeout` callback would leave the console in a broken state, since raw mode was enabled but never disabled.
Only tested on Linux with a supported terminal.
plen+cooked_cursor==cols => begin = -1 which is passed to substr. The
sign is incorrect as code should be removing a character from begin
instead of trying to add a character.
I noticed that multibyte characters can mess up the console state
variables. I decided to add a minimal multibyte support to make sure the
input only collects complete valid multibyte characters in case user
enters them to console.
This change assumes that UTF-32 has one to one mapping between printed
characters and char32 indexes. But I remember reading there is a few
rare corner cases with accents where character might require multiple
4byte characters too. But this patch at least changes correct handling
from about 100 characters to 99% of unicode characters.
There is a minor chance that console or init thread would access already
freed memory when core is shutting down and cleaning up state. To avoid
any danger of having random bugs caused by the potential data race I
decided to make sure the shutdown code waits for the thread to exit
first.
Windows change is completely untested. It is purely based on msdn
documentation.