diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-10-05 22:35:02 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-10-05 22:35:02 +0400 |
commit | 458de52151994854cd3fec191fe1761bca2c88d0 (patch) | |
tree | 43077ba99243e05ac14d2227013afe8ed1e10a0f /source/blender/editors/space_text | |
parent | 5bab95fc5800d674e3e093118df0ee080020c87d (diff) |
bugfix [#24148] unable to get keyboard mappings to work in the text window
this exposes another problem: RNA_property_is_set cant be used on properties set from a keymap, they are always set. for now check for string length.
Diffstat (limited to 'source/blender/editors/space_text')
-rw-r--r-- | source/blender/editors/space_text/text_ops.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index ed70f31f970..e3bf390dba8 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -2317,18 +2317,19 @@ static int insert_exec(bContext *C, wmOperator *op) static int insert_invoke(bContext *C, wmOperator *op, wmEvent *event) { - char str[2]; int ret; - /* XXX old code from winqreadtextspace, is it still needed somewhere? */ - /* smartass code to prevent the CTRL/ALT events below from not working! */ - /*if(qual & (LR_ALTKEY|LR_CTRLKEY)) - if(!ispunct(ascii)) - ascii= 0;*/ - str[0]= event->ascii; - str[1]= '\0'; + // if(!RNA_property_is_set(op->ptr, "text")) { /* always set from keymap XXX */ + if(!RNA_string_length(op->ptr, "text")) { + char str[2] = {event->ascii, '\0'}; + + /* if alt/ctrl/super are pressed pass through */ + if(event->alt || event->ctrl || event->oskey) + return OPERATOR_PASS_THROUGH; + + RNA_string_set(op->ptr, "text", str); + } - RNA_string_set(op->ptr, "text", str); ret = insert_exec(C, op); /* run the script while editing, evil but useful */ |