From d6bf3e2ad05051dcd7941244b7ebc2ee63d0301d Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Tue, 2 Jun 2015 20:54:48 +0800 Subject: [PATCH] src/Builder4/Editor.bjs src/Builder4/Editor.vala --- src/Builder4/Editor.bjs | 2 +- src/Builder4/Editor.vala | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Builder4/Editor.bjs b/src/Builder4/Editor.bjs index 3b5460a33..adb79618c 100644 --- a/src/Builder4/Editor.bjs +++ b/src/Builder4/Editor.bjs @@ -16,7 +16,7 @@ "# int pos_root_y" : "", "# string ptype" : "\"\"", "bool hexpand" : true, - "| int search" : "(string txt) {\n\n\tvar s = new Gtk.SourceSearchSettings();\n\t\n\tthis.sourcecontext = new Gtk.SourceSearchContext(this.buffer.el,s);\n\tsctx.set_highlight(true);\n\ts.set_search_text(txt);\n\treturn this.sourcecontext.get_occurences_count();\n\n}\n", + "| int search" : "(string txt) {\n\n\tvar s = new Gtk.SourceSearchSettings();\n\t\n\tthis.sourcecontext = new Gtk.SourceSearchContext(this.buffer.el,s);\n\tthis.sourcecontext .set_highlight(true);\n\ts.set_search_text(txt);\n\treturn this.sourcecontext.get_occurences_count();\n\n\n\tvar s = new Gtk.SourceSearchSettings();\n\tvar buf = (Gtk.SourceBuffer) this.sourceview.el.get_buffer();\n\tthis.sourcecontext = new Gtk.SourceSearchContext(buf,s);\n\tthis.sourcecontext.set_highlight(true);\n\ts.set_search_text(txt);\n\treturn this.sourcecontext.get_occurrences_count();\n\n \n\n}\n", "# string key" : "\"\"", "* pack" : "add", "xtype" : "Box", diff --git a/src/Builder4/Editor.vala b/src/Builder4/Editor.vala index 9ff8682db..8243a307e 100644 --- a/src/Builder4/Editor.vala +++ b/src/Builder4/Editor.vala @@ -120,10 +120,20 @@ public class Editor : Object var s = new Gtk.SourceSearchSettings(); this.sourcecontext = new Gtk.SourceSearchContext(this.buffer.el,s); - sctx.set_highlight(true); + this.sourcecontext .set_highlight(true); s.set_search_text(txt); return this.sourcecontext.get_occurences_count(); + + var s = new Gtk.SourceSearchSettings(); + var buf = (Gtk.SourceBuffer) this.sourceview.el.get_buffer(); + this.sourcecontext = new Gtk.SourceSearchContext(buf,s); + this.sourcecontext.set_highlight(true); + s.set_search_text(txt); + return this.sourcecontext.get_occurrences_count(); + + + } public void show (JsRender.JsRender file, JsRender.Node? node, string ptype, string key) { -- 2.39.2