[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [35534] trunk/blender: auto-complete was moving the selection.

Campbell Barton ideasman42 at gmail.com
Mon Mar 14 07:48:52 CET 2011


Revision: 35534
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35534
Author:   campbellbarton
Date:     2011-03-14 06:48:51 +0000 (Mon, 14 Mar 2011)
Log Message:
-----------
auto-complete was moving the selection.

Modified Paths:
--------------
    trunk/blender/release/scripts/op/console_python.py
    trunk/blender/source/blender/makesrna/intern/rna_space.c

Modified: trunk/blender/release/scripts/op/console_python.py
===================================================================
--- trunk/blender/release/scripts/op/console_python.py	2011-03-14 05:39:07 UTC (rev 35533)
+++ trunk/blender/release/scripts/op/console_python.py	2011-03-14 06:48:51 UTC (rev 35534)
@@ -240,12 +240,20 @@
 
         # 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.

Modified: trunk/blender/source/blender/makesrna/intern/rna_space.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_space.c	2011-03-14 05:39:07 UTC (rev 35533)
+++ trunk/blender/source/blender/makesrna/intern/rna_space.c	2011-03-14 06:48:51 UTC (rev 35534)
@@ -614,12 +614,11 @@
 	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;
 




More information about the Bf-blender-cvs mailing list