diff options
author | Ton Roosendaal <ton@blender.org> | 2012-10-29 23:18:13 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2012-10-29 23:18:13 +0400 |
commit | 734630fb78e3d700643fbf51ddde06e1c4f946bc (patch) | |
tree | 7df097464fe819e2a7e1fb86390262e3ba953cca | |
parent | 5a6c7afe5e344fbdb835ceb1677390a2903e4476 (diff) |
Bugfix:
3D text object editing, ALT+Backspace trick is back to construct special characters.
Like: O , Alt+Backspace , / creates an O with a / in it.
It also makes plus-minus, unequal, copyright, 1/2, 3/4. etc. Easy method you
never forget after using once!
Got broken with adding UTF support a year ago.
-rw-r--r-- | source/blender/editors/curve/editfont.c | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c index 2d039cfaf7f..9cab739317c 100644 --- a/source/blender/editors/curve/editfont.c +++ b/source/blender/editors/curve/editfont.c @@ -1251,8 +1251,12 @@ static int insert_text_invoke(bContext *C, wmOperator *op, wmEvent *evt) else ascii = 9; } - else if (event == BACKSPACEKEY) - ascii = 0; + + if (event == BACKSPACEKEY) { + if (alt && cu->len != 0 && cu->pos > 0) + accentcode = 1; + return OPERATOR_PASS_THROUGH; + } if (val && (ascii || evt->utf8_buf[0])) { /* handle case like TAB (== 9) */ @@ -1263,19 +1267,19 @@ static int insert_text_invoke(bContext *C, wmOperator *op, wmEvent *evt) (evt->utf8_buf[0])) { - if (evt->utf8_buf[0]) { - BLI_strncpy_wchar_from_utf8(inserted_text, evt->utf8_buf, 1); - ascii = inserted_text[0]; - insert_into_textbuf(obedit, ascii); - accentcode = 0; - } - else if (accentcode) { + if (accentcode) { if (cu->pos > 0) { inserted_text[0] = findaccent(ef->textbuf[cu->pos - 1], ascii); ef->textbuf[cu->pos - 1] = inserted_text[0]; } accentcode = 0; } + else if (evt->utf8_buf[0]) { + BLI_strncpy_wchar_from_utf8(inserted_text, evt->utf8_buf, 1); + ascii = inserted_text[0]; + insert_into_textbuf(obedit, ascii); + accentcode = 0; + } else if (cu->len < MAXTEXT - 1) { if (alt) { /* might become obsolete, apple has default values for this, other OS's too? */ @@ -1312,12 +1316,6 @@ static int insert_text_invoke(bContext *C, wmOperator *op, wmEvent *evt) text_update_edited(C, scene, obedit, 1, FO_EDIT); } } - else if (val && event == BACKSPACEKEY) { - if (alt && cu->len != 0 && cu->pos > 0) - accentcode = 1; - - return OPERATOR_PASS_THROUGH; - } else return OPERATOR_PASS_THROUGH; @@ -1330,7 +1328,8 @@ static int insert_text_invoke(bContext *C, wmOperator *op, wmEvent *evt) } /* reset property? */ - accentcode = 0; + if (val == 0) + accentcode = 0; return OPERATOR_FINISHED; } |