src/Builder4/Editor.bjs
authorAlan Knowles <alan@roojs.com>
Tue, 26 Mar 2024 14:40:14 +0000 (22:40 +0800)
committerAlan Knowles <alan@roojs.com>
Tue, 26 Mar 2024 14:40:14 +0000 (22:40 +0800)
src/Builder4/Editor.vala

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

index eafb520..1a72546 100644 (file)
               "pressed" : [
                "(n_press, x, y) => {",
                "\tGtk.TextIter iter;",
-               "",
+               "\tint  buffer_x, buffer_y;",
                "\tvar gut = _this.view.el.get_gutter(Gtk.TextWindowType.LEFT);",
                "\t",
-               "\t ",
+               "\t _this.view.el.window_to_buffer_coords (Gtk.TextWindowType.TEXT,",
+               "\t\t (int)x - gut.get_width(),  (int)y,",
+               "\t  out  buffer_x, out  buffer_y);",
                "\t_this.view.el.get_iter_at_location (out  iter,  ",
-               "\t\t\t(int)x - gut.get_width(),  (int)y);",
+               "\t\t\tbuffer_x,  buffer_y);;",
+               "\t",
+               "\t",
                "\tif (_this.buffer.el.iter_has_context_class(iter, \"comment\") ||",
                "\t\t_this.buffer.el.iter_has_context_class(iter, \"string\")",
                "\t) { ",
                "\t\t\t",
                "\t\t});",
                "\t\t",
+               "\t\t/*",
+               "\t\t\tthings that can ber returned..",
+               "\t\t\t\"int\" (type only)",
+               "\t\t\tprivae void ..",
+               "\t\t\tEditor xxxx._this",
+               "\t\t\t. ",
+               "\t\t*/",
+               "\t\t",
                "\t\t // could never get this to work anywhere..",
                "\t\t // looks like its probably for calling stuff..",
                "\t\t // but always returns null..",
index c538530..7ec122c 100644 (file)
@@ -1316,12 +1316,16 @@ public class Editor : Object
                        //listeners
                        this.el.pressed.connect( (n_press, x, y) => {
                                Gtk.TextIter iter;
-                       
+                               int  buffer_x, buffer_y;
                                var gut = _this.view.el.get_gutter(Gtk.TextWindowType.LEFT);
                                
-                                
+                                _this.view.el.window_to_buffer_coords (Gtk.TextWindowType.TEXT,
+                                        (int)x - gut.get_width(),  (int)y,
+                                 out  buffer_x, out  buffer_y);
                                _this.view.el.get_iter_at_location (out  iter,  
-                                               (int)x - gut.get_width(),  (int)y);
+                                               buffer_x,  buffer_y);;
+                               
+                               
                                if (_this.buffer.el.iter_has_context_class(iter, "comment") ||
                                        _this.buffer.el.iter_has_context_class(iter, "string")
                                ) { 
@@ -1360,6 +1364,14 @@ public class Editor : Object
                                                
                                        });
                                        
+                                       /*
+                                               things that can ber returned..
+                                               "int" (type only)
+                                               privae void ..
+                                               Editor xxxx._this
+                                               . 
+                                       */
+                                       
                                         // could never get this to work anywhere..
                                         // looks like its probably for calling stuff..
                                         // but always returns null..