[#22274] Special chars = 2 characters

workaround, just remove utf from number strings until we have proper UTF editing.
This commit is contained in:
2010-07-27 01:20:24 +00:00
parent dcb644af0d
commit 160b1d815d

View File

@@ -28,6 +28,7 @@
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "MEM_guardedalloc.h"
@@ -1535,6 +1536,19 @@ static void ui_textedit_begin(bContext *C, uiBut *but, uiHandleButtonData *data)
data->str= MEM_callocN(sizeof(char)*data->maxlen + 1, "textedit str");
ui_get_but_string(but, data->str, data->maxlen);
if(ELEM3(but->type, NUM, NUMABS, NUMSLI)) {
/* XXX: we dont have utf editing yet so for numbers its best to strip out utf chars
* this is so the deg' synbol isnt included in number editing fields: bug 22274 */
int i;
for(i=0; data->str[i]; i++) {
if(!isascii(data->str[i])) {
data->str[i]= '\0';
break;
}
}
}
data->origstr= BLI_strdup(data->str);
data->selextend= 0;
data->selstartx= 0;