From bb802607eb5a31b89f39705d9b2e07df7ad437ec Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Sun, 26 Nov 2006 16:03:36 +0000 Subject: [PATCH] Bugfix #1676 Ancient bug: texteditor input was limited to "isprint()" characters, the default non-accented simple ascii set. I've removed that. Now we still have a conflict with hotkey handling, so ALT+character input won't work. But, for keyboards that have special character keys from itself, this patch will allow typing them in Text now. --- source/blender/blenkernel/intern/text.c | 22 ++++++++-------------- source/blender/src/drawtext.c | 6 ++++-- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index d40da84e211..257d0f0862e 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -32,7 +32,6 @@ * ***** END GPL/BL DUAL LICENSE BLOCK ***** */ -#include /* isprint() */ #include /* strstr */ #include "MEM_guardedalloc.h" @@ -553,13 +552,6 @@ int txt_get_span (TextLine *from, TextLine *to) return ret; } -static int txt_illegal_char (char c) -{ - if (isprint(c) || c=='\t') return 0; - - return 1; -} - static void txt_make_dirty (Text *text) { text->flags |= TXT_ISDIRTY; @@ -1285,7 +1277,8 @@ void txt_paste(Text *text) } \ } -static void dump_buffer(Text *text) { +static void dump_buffer(Text *text) +{ int i= 0; while (i++undo_pos) printf("%d: %d %c\n", i, text->undo_buf[i], text->undo_buf[i]); @@ -1954,7 +1947,8 @@ void txt_do_redo(Text *text) /* Line editing functions */ /**************************/ -void txt_split_curline (Text *text) { +void txt_split_curline (Text *text) +{ TextLine *ins; char *left, *right, *fleft, *fright; @@ -2072,7 +2066,8 @@ void txt_delete_char (Text *text) if(!undoing) txt_undo_add_charop(text, UNDO_DEL, c); } -void txt_backspace_char (Text *text) { +void txt_backspace_char (Text *text) +{ char c='\n'; if (!text) return; @@ -2110,7 +2105,8 @@ void txt_backspace_char (Text *text) { if(!undoing) txt_undo_add_charop(text, UNDO_BS, c); } -int txt_add_char (Text *text, char add) { +int txt_add_char (Text *text, char add) +{ int len; char *tmp, *format; @@ -2122,8 +2118,6 @@ int txt_add_char (Text *text, char add) { return 1; } - if(txt_illegal_char(add)) return 0; - txt_delete_sel(text); tmp= MEM_mallocN(text->curl->len+2, "textline_string"); diff --git a/source/blender/src/drawtext.c b/source/blender/src/drawtext.c index 748cb0fffe4..d8e2107e145 100644 --- a/source/blender/src/drawtext.c +++ b/source/blender/src/drawtext.c @@ -1417,8 +1417,10 @@ void winqreadtextspace(ScrArea *sa, void *spacedata, BWinEvent *evt) int do_draw=0, p; /* smartass code to prevent the CTRL/ALT events below from not working! */ - if(!ispunct(ascii)) - if (!isprint(ascii) || (G.qual & ~LR_SHIFTKEY)) ascii= 0; + if(G.qual & (LR_ALTKEY|LR_CTRLKEY)) + if(!ispunct(ascii)) + if(!isprint(ascii)) + ascii= 0; text= st->text;