diff --git a/release/scripts/op/console_python.py b/release/scripts/op/console_python.py index 84b2ed24350..4a2eb833d83 100644 --- a/release/scripts/op/console_python.py +++ b/release/scripts/op/console_python.py @@ -240,12 +240,20 @@ def autocomplete(context): # This function isnt aware of the text editor or being an operator # just does the autocomp then copy its results back - current_line.body, current_line.current_character, scrollback = \ - intellisense.expand( - line=current_line.body, + result = intellisense.expand( + line=line, cursor=current_line.current_character, namespace=console.locals, private=bpy.app.debug) + + line_new = result[0] + current_line.body, current_line.current_character, scrollback = result + del result + + # update sel. setting body should really do this! + ofs = len(line_new) - len(line) + sc.select_start += ofs + sc.select_end += ofs except: # unlikely, but this can happen with unicode errors for example. # or if the api attribute access its self causes an error. diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 42800ca84f3..6b0ae7eec80 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -614,12 +614,11 @@ static void rna_ConsoleLine_body_set(PointerRNA *ptr, const char *value) ConsoleLine *ci= (ConsoleLine*)ptr->data; int len= strlen(value); - if((len >= ci->len_alloc) || (len * 2 < ci->len_alloc) ) { /* allocate a new strnig */ + if((len >= ci->len_alloc) || (len * 2 < ci->len_alloc) ) { /* allocate a new string */ MEM_freeN(ci->line); ci->line= MEM_mallocN((len + 1) * sizeof(char), "rna_consoleline"); ci->len_alloc= len + 1; } - memcpy(ci->line, value, len + 1); ci->len= len;