Fix #7369 - fix goto line
authorAlan <alan@roojs.com>
Wed, 31 Aug 2022 08:47:26 +0000 (16:47 +0800)
committerAlan <alan@roojs.com>
Wed, 31 Aug 2022 08:47:26 +0000 (16:47 +0800)
src/Builder4/GtkView.bjs
src/Builder4/GtkView.vala
src/Builder4/WindowRooView.bjs
src/Builder4/WindowRooView.vala
src/Builder4/WindowState.vala

index 494783e..5d46166 100644 (file)
    ],
    "| void scroll_to_line" : [
     "(int line) {",
-    "   this.notebook.el.page = 1;// code preview...",
+    "  // code preview...",
     "   ",
-    "   GLib.Timeout.add(500, () => {",
+    "   GLib.Timeout.add(100, () => {",
     "   ",
     "   ",
-    "\t   ",
+    "\t    this.notebook.el.set_current_page(1);",
     "\t   ",
     "\t\t  var buf = this.sourceview.el.get_buffer();",
     "\t ",
index cccf717..7991ac6 100644 (file)
@@ -321,12 +321,12 @@ public class Xcls_GtkView : Object
          
     }
     public void scroll_to_line (int line) {
-       this.notebook.el.page = 1;// code preview...
+      // code preview...
        
-       GLib.Timeout.add(500, () => {
+       GLib.Timeout.add(100, () => {
        
        
-          
+           this.notebook.el.set_current_page(1);
           
                  var buf = this.sourceview.el.get_buffer();
         
index e066de4..6d9ac28 100644 (file)
    ],
    "| void scroll_to_line" : [
     "(int line) {",
-    "   this.notebook.el.page = 1;// code preview...",
-    "   ",
-    "   GLib.Timeout.add(500, () => {",
+    "   // code preview...",
     "   ",
+    "   GLib.Timeout.add(100, () => {",
     "   ",
+    "\t\tthis.notebook.el.set_current_page( 1 );",
     "\t   ",
     "\t   ",
     "\t\t  var buf = this.sourceview.el.get_buffer();",
index dbbf4b9..b567e92 100644 (file)
@@ -256,11 +256,11 @@ public class Xcls_WindowRooView : Object
          
     }
     public void scroll_to_line (int line) {
-       this.notebook.el.page = 1;// code preview...
-       
-       GLib.Timeout.add(500, () => {
+       // code preview...
        
+       GLib.Timeout.add(100, () => {
        
+               this.notebook.el.set_current_page( 1 );
           
           
                  var buf = this.sourceview.el.get_buffer();
index 4629069..50cd09e 100644 (file)
@@ -593,11 +593,14 @@ public class WindowState : Object
        public void gotoLine(int line)
        {
        
+               if (line < 0) {
+                       return;
+               }
                if (file.xtype == "PlainFile") {
                    this.switchState (State.CODEONLY); 
-                       if (line> -1) {
-                               this.code_editor_tab.scroll_to_line(line);
-                       }
+                        
+                       this.code_editor_tab.scroll_to_line(line);
+                        
                } else {
                
                        this.switchState (State.PREVIEW); 
@@ -605,9 +608,10 @@ public class WindowState : Object
                        if (file.project.xtype == "Gtk" && line> -1 ) {
                                // fixme - show the editing tab.
                                this.window_gladeview.scroll_to_line(line);
-                       } 
+                       } else {
+                               this.window_rooview.scroll_to_line(line);
                        // fixme - what about Roo?
-
+                       }
                }
        
        }