diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2012-04-09 05:42:44 +0400 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2012-04-09 05:42:44 +0400 |
commit | bcd6c84a66280c5eeed363c91638deeecbcb91f1 (patch) | |
tree | a15f8e57972e2739383373e1a40f2904e97832eb /source/gameengine/GameLogic/SCA_KeyboardSensor.cpp | |
parent | 891b46e074f28330003eb1484712a3c052008b48 (diff) |
bugfix [#30760] edit text property bug
backspace was messing up with utf8 text.
hijacking Blender utf8 functions
tested in CMake but I think scons should work too. No idea about pure 'make'
Happy Easter ;)
Diffstat (limited to 'source/gameengine/GameLogic/SCA_KeyboardSensor.cpp')
-rw-r--r-- | source/gameengine/GameLogic/SCA_KeyboardSensor.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp b/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp index 48237a1b467..704b244c52c 100644 --- a/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp +++ b/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp @@ -39,6 +39,10 @@ #include "StringValue.h" #include "SCA_IInputDevice.h" +extern "C" { + #include "BLI_string_cursor_utf8.h" +} + /* ------------------------------------------------------------------------- */ /* Native functions */ /* ------------------------------------------------------------------------- */ @@ -338,7 +342,11 @@ void SCA_KeyboardSensor::AddToTargetProp(int keyIndex) STR_String newprop = tprop->GetText(); int oldlength = newprop.Length(); if (oldlength >= 1 ) { - newprop.SetLength(oldlength - 1); + int newlength=oldlength; + + BLI_str_cursor_step_prev_utf8(newprop, NULL, &newlength); + newprop.SetLength(newlength); + CStringValue * newstringprop = new CStringValue(newprop, m_targetprop); GetParent()->SetProperty(m_targetprop, newstringprop); newstringprop->Release(); |