src/Builder4/Editor.bjs
[app.Builder.js] / src / Builder4 / Editor.vala
index a5758af..a97f69b 100644 (file)
@@ -120,13 +120,14 @@ public class Editor : Object
                 val = node.props.get(key);
             }
             this.view.load(val);
-    
+            this.key_edit.el.show();
+            this.key_edit.el.text = key;  
         
         } else {
             this.view.load(        file.toSource() );
-    
+            this.key_edit.el.hide();
         }
-        this.key_edit.el.text = key;  
+    
            
     }
     public class Xcls_Box2 : Object
@@ -336,7 +337,7 @@ public class Editor : Object
         
         
           // this.get('/BottomPane').el.set_current_page(0);
-          var buf = (Gtk.SourceBuffer)this.el.get_buffer();
+            var buf = (Gtk.SourceBuffer)this.el.get_buffer();
             buf.set_text(str, str.length);
             buf.set_undo_manager(null);
             
@@ -345,9 +346,13 @@ public class Editor : Object
             if (_this.file != null) {
                  lang = _this.file.language;
             }
-            //?? is javascript going to work as js?
             
-            ((Gtk.SourceBuffer)(this.el.get_buffer())) .set_language(lm.get_language(lang));
+         
+            ((Gtk.SourceBuffer)(this.el.get_buffer())) .set_language(
+                    _this.file.content_type.length > 0  ?
+                    lm.guess_language(_this.file.path, _this.file.content_type) :
+                    lm.get_language(lang)
+                );
          
              
             _this.dirty = false;
@@ -551,7 +556,7 @@ public class Editor : Object
             
             }
             var valafn = _this.file.path;
-            print("%s : %s", _this.file.path, _this.file.xtype);
+         
             if (_this.file.xtype != "PlainFile") {
         
         
@@ -560,7 +565,8 @@ public class Editor : Object
                  valafn = "";
                   try {             
                        var  regex = new Regex("\\.bjs$");
-                    
+                       // should not happen
+                      
                      
                         valafn = regex.replace(_this.file.path,_this.file.path.length , 0 , ".vala");
                      } catch (GLib.RegexError e) {