From f1a4f70ae5bfd68eace6e03d9693d59824848f84 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Tue, 26 Mar 2024 22:40:14 +0800 Subject: [PATCH] src/Builder4/Editor.bjs src/Builder4/Editor.vala --- src/Builder4/Editor.bjs | 18 +++++++++++++++--- src/Builder4/Editor.vala | 18 +++++++++++++++--- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/src/Builder4/Editor.bjs b/src/Builder4/Editor.bjs index eafb52000..1a725467f 100644 --- a/src/Builder4/Editor.bjs +++ b/src/Builder4/Editor.bjs @@ -600,12 +600,16 @@ "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) { ", @@ -644,6 +648,14 @@ "\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..", diff --git a/src/Builder4/Editor.vala b/src/Builder4/Editor.vala index c538530f2..7ec122c7f 100644 --- a/src/Builder4/Editor.vala +++ b/src/Builder4/Editor.vala @@ -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.. -- 2.39.2