src/Builder4/Editor.bjs
authorAlan Knowles <alan@roojs.com>
Thu, 18 Jan 2024 14:53:38 +0000 (22:53 +0800)
committerAlan Knowles <alan@roojs.com>
Thu, 18 Jan 2024 14:53:38 +0000 (22:53 +0800)
src/Builder4/Editor.vala

src/Builder4/Editor.bjs
src/Builder4/Editor.vala

index 443fb83..d7ac919 100644 (file)
            "\tGtk.TextIter iter;",
            "\t_this.buffer.el.get_iter_at_offset( out iter, _this.buffer.el.cursor_position);  ",
            "\tvar line  = iter.get_line();",
-           "\tvar offs = iter.get_line_offset();",
+           "\tvar offset = iter.get_line_offset();",
            "\tGLib.debug(\"line  %d  off %d\", line ,offset);",
-           "\t",
+           "\tif (this.editor.prop != null) {",
+           "\t\tline += this.editor.prop.start_line + 1; // i think..",
+           "\t\toffset += 12; // should probably be 8 without namespaced ",
+           "\t\tGLib.debug(\"guess line  %d  off %d\", line ,offset);",
+           "\t} ",
            "    //_this.view.el.show_completion();",
            "   // print(event.key.keyval)",
            "   ",
index 9d1f927..9c79242 100644 (file)
@@ -1084,9 +1084,13 @@ public class Editor : Object
                                Gtk.TextIter iter;
                                _this.buffer.el.get_iter_at_offset( out iter, _this.buffer.el.cursor_position);  
                                var line  = iter.get_line();
-                               var offs = iter.get_line_offset();
+                               var offset = iter.get_line_offset();
                                GLib.debug("line  %d  off %d", line ,offset);
-                               
+                               if (this.editor.prop != null) {
+                                       line += this.editor.prop.start_line + 1; // i think..
+                                       offset += 12; // should probably be 8 without namespaced 
+                                       GLib.debug("guess line  %d  off %d", line ,offset);
+                               } 
                            //_this.view.el.show_completion();
                           // print(event.key.keyval)