src/Builder4/MainWindow.bjs
authorAlan Knowles <alan@roojs.com>
Fri, 2 Feb 2024 07:20:31 +0000 (15:20 +0800)
committerAlan Knowles <alan@roojs.com>
Fri, 2 Feb 2024 07:20:31 +0000 (15:20 +0800)
src/Builder4/MainWindow.vala

src/Builder4/MainWindow.bjs
src/Builder4/MainWindow.vala

index dd0a833..543eae5 100644 (file)
            "( ) => {",
            "\t",
            "\tGLib.debug(\"undo clicked\");",
-           "\t",
+           "\tif (_this.windowstate.file.xtype == \"PlainFile\") {",
+           "\t\t_this.codeeditviewbox.view.el.undo();",
+           "\t}",
            "\tif (!_this.windowstate.file.undoStep(-1)) {",
            "\t\treturn;",
            "\t}",
            "\t",
-           "\tif (_this.windowstate.file.xtype == \"PlainFile\") {",
-           "\t\t_this.codeeditviewbox.el.show();",
-           "\t\t_this.windowstate.switchState (WindowState.State.CODEONLY); ",
            "\t ",
-           "\t\t_this.windowstate.code_editor_tab.show(_this.windowstate.file, null, null);",
-           "\t\t ",
-           "\t} else {",
-           "\t",
-           "\t\t_this.windowstate.switchState (WindowState.State.PREVIEW); ",
-           "\t\t// this triggers loadItems..",
-           "\t\t_this.windowstate.left_tree.model.loadFile(",
-           "\t\t\t_this.windowstate.file);",
-           "\t\t ",
+           "\t_this.windowstate.switchState (WindowState.State.PREVIEW); ",
+           "\t// this triggers loadItems..",
+           "\t_this.windowstate.left_tree.model.loadFile(",
+           "\t\t_this.windowstate.file);",
+           "\t ",
            "",
-           "\t}",
+           "\t",
            " ",
            "",
            "\t// load it everywhere",
index c53b1ec..6050efd 100644 (file)
@@ -332,26 +332,21 @@ public class Xcls_MainWindow : Object
                        this.el.clicked.connect( ( ) => {
                                
                                GLib.debug("undo clicked");
-                               
+                               if (_this.windowstate.file.xtype == "PlainFile") {
+                                       _this.codeeditviewbox.view.el.undo();
+                               }
                                if (!_this.windowstate.file.undoStep(-1)) {
                                        return;
                                }
                                
-                               if (_this.windowstate.file.xtype == "PlainFile") {
-                                       _this.codeeditviewbox.el.show();
-                                       _this.windowstate.switchState (WindowState.State.CODEONLY); 
                                 
-                                       _this.windowstate.code_editor_tab.show(_this.windowstate.file, null, null);
-                                        
-                               } else {
-                               
-                                       _this.windowstate.switchState (WindowState.State.PREVIEW); 
-                                       // this triggers loadItems..
-                                       _this.windowstate.left_tree.model.loadFile(
-                                               _this.windowstate.file);
-                                        
+                               _this.windowstate.switchState (WindowState.State.PREVIEW); 
+                               // this triggers loadItems..
+                               _this.windowstate.left_tree.model.loadFile(
+                                       _this.windowstate.file);
+                                
                        
-                               }
+                               
                         
                        
                                // load it everywhere