h/t Pere for adding the missing pieces.
WIP b/c there's one minor side effect that needs addressing
(final label, highlighted red, does not lose its highlight)
Onscreen keyboard repositions itself to the top if you use [Enter]
to move the cursor down, and it begins overlapping the keyboard.
Also, play "carriage return" sound effect, even when entering
a blank 'line' of text.
Fixed the issue with the backspace not working in text and label tools
when in certain language modes in macOS. Mac keyboards have the DELETE
key where PC keyboards have the BACKSPACE key, and the two keys have
different keycodes, so the backspace requires special handling on the
macOS in programs writtens for the PC.
Avoid leaking memory when loading Label text strings from a saved drawing.
Also, a heck of a lot of comments to explain (as best I understand)
what load_info_about_label_surface() is doing.
Starting work towards
https://sourceforge.net/p/tuxpaint/feature-requests/213/
The ability to 'apply' a label to the canvas, making it permanent
(as if added using the "Text" tool instead).
Removed unused "label rotate" option's code (and hence addressed
a bug we didn't relalize when choosing the "Label" tool while in
in "--nostampcontrols" mode; the unused "rotate" button would appear).
Show tips when choosing brushes, to remind the user when they
are animated, and or rotational/directional.
Show tips when brush spacing is changed, specifying the approximate
spacing. Output is fuzzy, to avoid being overly technical (e.g., it
will never say "2 345/1000 times as big as" or "1/103 the size of")
Occasionally running Tux Paint in Korean, Japanese, and possibly other
languages would cause Tux Paint to crash. This commit fixes it.
This bug was previously mentioned as the possible cause of these
previously reported crashes, though they were determined to be
unrelated:
https://sourceforge.net/p/tuxpaint/mailman/message/37364981/https://sourceforge.net/p/tuxpaint/mailman/message/37376574/
The cause of the crash turned out to be in the function that loads the
input method map (*.im). Some languages that use more than one
keystroke to produce one unicode character use this mapfile to track, in
a state machine, what keys have been pressed and what unicode character
should be output. This state machine's memory is increased dynamically
as needed when the input method map file is loaded. There was a line of
code that references the old memory that could have moved by the memory
increase. This line of code has been moved to prior to the memory
increase to avoid accessing memory that may have moved.
It appears the system language detection doesn't work on [some versions
of?] macOS. Fixed.
Strangely, querying the Cocoa API for the system locale on a system in
US with the preferred language set to Korean produces the invalid locale
"ko-US" instead of the expected "ko-KR". This behavior of returning the
language with a invalid region qualifier for the language appears to
happen only with languages where macOS does not have regional variants
(this issue does not seem to occur with Canadian English, en-CA, for
example.) A fuzzy matching locale function has been added to handle
this issue.