src/Builder4/Editor.bjs
authorAlan Knowles <alan@roojs.com>
Sun, 24 Mar 2024 02:55:30 +0000 (10:55 +0800)
committerAlan Knowles <alan@roojs.com>
Sun, 24 Mar 2024 02:55:30 +0000 (10:55 +0800)
src/Builder4/Editor.vala

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

index dfffb9b..f6a2b69 100644 (file)
               "pressed" : [
                "(n_press, x, y) => {",
                "\tGtk.TextIter iter;",
-               "\t_this.view.el.get_iter_at_location (out  iter,  (int)x,  (int)y);",
+               "\tint buffer_x, buffer_y;",
+               "\t_this.viewwindow_to_buffer_coords (",
+               "\t\t\tGtk.TextWindowTyp.TEXT, ",
+               "\t\t\t",
+               "\t\t\t(int)x, (int)y, out  buffer_x, out  buffer_y)",
+               "",
+               "\t_this.view.el.get_iter_at_location (out  iter,  buffer_x,  buffer_x;",
                "\tif (_this.buffer.el.iter_has_context_class(iter, \"comment\") ||",
                "\t\t_this.buffer.el.iter_has_context_class(iter, \"string\")",
                "\t) { ",
index 1c15c53..ae747f1 100644 (file)
@@ -1316,7 +1316,13 @@ public class Editor : Object
                        //listeners
                        this.el.pressed.connect( (n_press, x, y) => {
                                Gtk.TextIter iter;
-                               _this.view.el.get_iter_at_location (out  iter,  (int)x,  (int)y);
+                               int buffer_x, buffer_y;
+                               _this.viewwindow_to_buffer_coords (
+                                               Gtk.TextWindowTyp.TEXT, 
+                                               
+                                               (int)x, (int)y, out  buffer_x, out  buffer_y)
+                       
+                               _this.view.el.get_iter_at_location (out  iter,  buffer_x,  buffer_x;
                                if (_this.buffer.el.iter_has_context_class(iter, "comment") ||
                                        _this.buffer.el.iter_has_context_class(iter, "string")
                                ) {