Force word characters for compile targets
[roobuilder] / src / Builder4 / ValaProjectSettingsPopover.bjs
index 7eb6815..8cd541d 100644 (file)
                "xtype" : "Label"
               },
               {
+               "# bool in_insert" : false,
                "$ xns" : "Gtk",
+               "* init" : [
+                "",
+                "var ed = (this.el.get_delegate() as Gtk.Editable);",
+                "if (ed != null) {",
+                "\ted.insert_text.connect((text, length, ref position) => {",
+                "\t\tif (this.in_insert) {",
+                "\t\t\treturn;",
+                "\t\t}",
+                "\t\tGLib.debug(\"got insert text %s\", text);",
+                "\t\t",
+                "\t\tvar nt = \"\";",
+                "\t\tfor(var i = 0;i < text.length; i++){ ",
+                "\t\t\tif (Posix.isupper(text[i]) ||Posix.islower(text[i])  ) {",
+                "\t\t\t\tnt +=  text[i].to_string();",
+                "\t\t\t}\t",
+                "\t\t}",
+                "\t\tif (nt.length < 1) {",
+                "\t\t\tGLib.Signal.stop_emission_by_name(ed, \"insert_text\");",
+                "\t\t\treturn;",
+                "\t\t}",
+                "",
+                "\t\tthis.in_insert = true;",
+                "\t ",
+                "\t\tthis.el.insert_text(nt,nt.length, ref position);",
+                "\t\tthis.in_insert = false;",
+                "\t\tGLib.Signal.stop_emission_by_name(ed, \"insert_text\");",
+                "\t});",
+                "",
+                "}"
+               ],
                "id" : "build_name",
                "listeners" : {
                 "changed" : [
                  "",
                  "\t_this.selected_target.name = this.el.buffer.text;",
                  "}"
+                ],
+                "insert_text" : [
+                 "(text, length, ref position) => {",
+                 "\tif (this.in_insert) {",
+                 "\t\treturn;",
+                 "\t}",
+                 "\tGLib.debug(\"got insert text %s\", text);",
+                 "\t",
+                 "\tvar nt = \"\";",
+                 "\tfor(var i = 0;i < text.length; i++){ ",
+                 "\t\tif (Posix.isalpha(text[i])) {",
+                 "\t\t\tnt +=  text[i].to_string();",
+                 "\t\t}\t",
+                 "\t}",
+                 "\tif (nt.length < 1) {",
+                 "\t\treturn;",
+                 "\t}",
+                 "",
+                 "\tthis.in_insert = true;",
+                 " ",
+                 "\tthis.el.insert_text(text,length, ref position);",
+                 "\tthis.in_insert = false;",
+                 "}",
+                 ""
                 ]
                },
                "xtype" : "Entry"