From: Enrico Zini Date: Thu, 13 Aug 2009 16:09:27 +0000 (+0100) Subject: Separate lines in a multiline grammar X-Git-Url: https://git.toastfreeware.priv.at/gregoa/zavai.git/commitdiff_plain/6197ea150251ee88059a62676f984af779a3e059 Separate lines in a multiline grammar --- diff --git a/src/app_polygen.vala b/src/app_polygen.vala index 3b2538f..b3a997a 100644 --- a/src/app_polygen.vala +++ b/src/app_polygen.vala @@ -63,6 +63,7 @@ protected class PolygenRun : Gtk.VBox protected Gtk.TextBuffer text_buffer; protected Gtk.TextView text; protected Regex unhtml; + protected Regex seplines; public string grm_name { get; set; } public string grm_type { get; set; } @@ -72,6 +73,7 @@ protected class PolygenRun : Gtk.VBox grm_name = ""; grm_type = ""; unhtml = new Regex("[ ]*<[^>]+>[ ]*", 0, 0); + seplines = new Regex("\n"); text_buffer = new Gtk.TextBuffer(null); text = new Gtk.TextView.with_buffer(text_buffer); text.wrap_mode = Gtk.WrapMode.WORD; @@ -116,7 +118,10 @@ protected class PolygenRun : Gtk.VBox if (grm_type == "line/html" || grm_type == "block/html") { result = unhtml.replace(result, (long)res_len, 0, " ", 0); + } else if (grm_type == "line/text") { + result = seplines.replace(result, (long)res_len, 0, "\n\n", 0); } + text_buffer.text = result; Gtk.TextIter iter;