src/Builder4/WindowRooView.bjs
[app.Builder.js] / src / Builder4 / WindowRooView.vala
index c0e146f..bc24b67 100644 (file)
@@ -1139,6 +1139,9 @@ public class Xcls_WindowRooView : Object
             
             Gtk.TextIter cur_iter;
             sbuf.get_iter_at_offset(out cur_iter, sbuf.cursor_position);
+           
+            var cursor_at_line = cur_iter.get_line();
+            
             
             //var cur_line = cur_iter.get_line();
             //if (cur_line > sel.line_start && cur_line < sel.line_end) {
@@ -1154,6 +1157,9 @@ public class Xcls_WindowRooView : Object
             
             
             this.el.editable = false;
+            
+            var before_cursor_string = "";
+            
             // now if we have selected a property...
             if (this.propSelected.length> 0 ) {
         
@@ -1162,12 +1168,31 @@ public class Xcls_WindowRooView : Object
                                start_line = nstart;
                                end_line = nend;
                                this.el.editable = true;
+                               
+                               
+                                       // see if we are 'right of ':'
+                                       // get an iter for the start of the line.
+                                       Gtk.TextIter start_line_iter, end_start_line_iter;
+                                       this.el.buffer.get_iter_at_line(out start_line_iter, start_line);
+                                       this.el.buffer.get_iter_at_line(out end_start_line_iter, start_line+1);
+                               if (start_line == cursor_at_line) {
+                                       var before_cursor_string = this.el.buffer.get_text(start_line_iter, cur_iter, false);
+                                       if (!before_cursor_string.contains(":")) {
+                                               this.el.editable = false;
+                                       }
+                                       
+                               }
+                               
+                               
                        }
                        print("propSelected = %s range  %d -> %d\n", this.propSelected, start_line, end_line);          
                        
                        
             }
             
+            
+            
+            
             // check selection - if it's out of 'bounds'
             if (this.el.editable && sbuf.get_has_selection()) {
                        Gtk.TextIter sel_start_iter, sel_end_iter;
@@ -1310,10 +1335,15 @@ public class Xcls_WindowRooView : Object
                
                 print("- PREVIEW EDITOR CHANGED--");
                 
+                this.dirty = true;    
+                if (!this.checkSyntax()) {
+                       return;
+               }               
                 
-                 this.checkSyntax();
+               // what are we editing??
                
-                this.dirty = true;
+               
+            
             
             
                 return ;
@@ -1380,7 +1410,7 @@ public class Xcls_WindowRooView : Object
             
          
             if (_this.file.language != "js") {
-                       return false; // no syntax.
+                       return false; // fake syntax error.
                }