diff --git a/core/Objects/Item.vala b/core/Objects/Item.vala index fac1d45ae..5cdba8939 100644 --- a/core/Objects/Item.vala +++ b/core/Objects/Item.vala @@ -1537,7 +1537,7 @@ public class Objects.Item : Objects.BaseObject { } public string to_markdown (int level = 0) { - string text = "%*s- %s%s%s\n".printf (level * 2, "", checked ? "[x]" : "[ ]", Utils.Datetime.get_markdown_format_date(this), content); + string text = "%*s- %s%s%s\n".printf (level * 2, "", checked ? "[x]" : "[ ]", Utils.Datetime.get_markdown_format_date (this), content); foreach (Objects.Item item in items) { text += item.to_markdown (level + 1); diff --git a/core/Util/Util.vala b/core/Util/Util.vala index e916bcc95..54c94b222 100644 --- a/core/Util/Util.vala +++ b/core/Util/Util.vala @@ -1073,7 +1073,7 @@ We hope you’ll enjoy using Planify!"""); try { Regex mailto_regex = /(?P[a-zA-Z0-9\._\%\+\-]+@[a-zA-Z0-9\-\.]+\.[a-zA-Z]+(\S*))/; Regex url_regex = /(?P(http|https)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]+(\/\S*))/; - Regex url_markdown = new Regex("\\[([^\\]]+)\\]\\(([^\\)]+)\\)"); + Regex url_markdown = new Regex ("\\[([^\\]]+)\\]\\(([^\\)]+)\\)"); Regex italic_bold_regex = /\*\*\*(.*?)\*\*\*/; Regex bold_regex = /\*\*(.*?)\*\*/; @@ -1081,7 +1081,7 @@ We hope you’ll enjoy using Planify!"""); MatchInfo info; - List emails = new List(); + List emails = new List (); if (mailto_regex.match (text, 0, out info)) { do { var email = info.fetch_named ("mailto"); @@ -1089,14 +1089,14 @@ We hope you’ll enjoy using Planify!"""); } while (info.next ()); } - Gee.ArrayList markdown_urls = new Gee.ArrayList(); + Gee.ArrayList markdown_urls = new Gee.ArrayList (); if (url_markdown.match (text, 0, out info)) { do { markdown_urls.add (new RegexMarkdown (info.fetch (0), info.fetch (1), info.fetch (2))); } while (info.next ()); } - List urls = new List(); + List urls = new List (); if (url_regex.match (text, 0, out info)) { do { var url = info.fetch_named ("url"); @@ -1107,21 +1107,21 @@ We hope you’ll enjoy using Planify!"""); } while (info.next ()); } - Gee.ArrayList bolds_01 = new Gee.ArrayList(); + Gee.ArrayList bolds_01 = new Gee.ArrayList (); if (bold_regex.match (text, 0, out info)) { do { bolds_01.add (new RegexMarkdown (info.fetch (0), info.fetch (1))); } while (info.next ()); } - Gee.ArrayList italics_01 = new Gee.ArrayList(); + Gee.ArrayList italics_01 = new Gee.ArrayList (); if (italic_regex.match (text, 0, out info)) { do { italics_01.add (new RegexMarkdown (info.fetch (0), info.fetch (1))); } while (info.next ()); } - Gee.ArrayList italic_bold = new Gee.ArrayList(); + Gee.ArrayList italic_bold = new Gee.ArrayList (); if (italic_bold_regex.match (text, 0, out info)) { do { italic_bold.add (new RegexMarkdown (info.fetch (0), info.fetch (1))); diff --git a/core/Widgets/Markdown/Color.vala b/core/Widgets/Markdown/Color.vala index c7603e9ea..8d6a4d746 100644 --- a/core/Widgets/Markdown/Color.vala +++ b/core/Widgets/Markdown/Color.vala @@ -36,25 +36,25 @@ namespace Color { } public inline HSL rgb_to_hsl (RGB rgb, out HSL hsl = null) { - hsl = HSL(); + hsl = HSL (); float s, v; - Gtk.rgb_to_hsv(rgb.r, rgb.g, rgb.b, out hsl.h, out s, out v); + Gtk.rgb_to_hsv (rgb.r, rgb.g, rgb.b, out hsl.h, out s, out v); hsl.l = v - v * s / 2; float m = float.min (hsl.l, 1 - hsl.l); - hsl.s = (m != 0) ? (v-hsl.l)/m : 0; + hsl.s = (m != 0) ? (v-hsl.l) / m : 0; return hsl; } public inline RGB hsl_to_rgb (HSL hsl, out RGB rgb = null) { - rgb = RGB(); + rgb = RGB (); float v = hsl.s * float.min (hsl.l, 1 - hsl.l) + hsl.l; - float s = (v != 0) ? 2-2*hsl.l/v : 0; - Gtk.hsv_to_rgb(hsl.h, s, v, out rgb.r, out rgb.g, out rgb.b); + float s = (v != 0) ? 2 - 2 * hsl.l / v : 0; + Gtk.hsv_to_rgb (hsl.h, s, v, out rgb.r, out rgb.g, out rgb.b); return rgb; } public inline RGB RGBA_to_rgb (Gdk.RGBA rgba, out RGB rgb = null) { - rgb = RGB(); + rgb = RGB (); rgb.r = rgba.red; rgb.g = rgba.green; rgb.b = rgba.blue; @@ -62,7 +62,7 @@ namespace Color { } public inline Gdk.RGBA rgb_to_RGBA (RGB rgb, out Gdk.RGBA rgba = null) { - rgba = Gdk.RGBA(); + rgba = Gdk.RGBA (); rgba.red = rgb.r; rgba.green = rgb.g; rgba.blue = rgb.b; diff --git a/core/Widgets/Markdown/MarkdownBuffer.vala b/core/Widgets/Markdown/MarkdownBuffer.vala index 95f9d6e5f..41fc330bb 100644 --- a/core/Widgets/Markdown/MarkdownBuffer.vala +++ b/core/Widgets/Markdown/MarkdownBuffer.vala @@ -15,6 +15,6 @@ public class Widgets.Markdown.Buffer : GtkSource.Buffer { Gtk.TextIter start, end; get_start_iter (out start); get_end_iter (out end); - return get_text(start, end, true); + return get_text (start, end, true); } -} \ No newline at end of file +} diff --git a/core/Widgets/Markdown/MarkdownEditView.vala b/core/Widgets/Markdown/MarkdownEditView.vala index 864f0383f..055822307 100644 --- a/core/Widgets/Markdown/MarkdownEditView.vala +++ b/core/Widgets/Markdown/MarkdownEditView.vala @@ -199,7 +199,7 @@ public void on_dark_changed (bool dark) { markdown_view.dark = dark; } - + private void format_selection (string affix, string second_affix) { var buffer = markdown_view.buffer; @@ -258,19 +258,19 @@ } public void format_selection_bold () { - format_selection("**", "__"); + format_selection ("**", "__"); } public void format_selection_italic () { - format_selection("_", "*"); + format_selection ("_", "*"); } public void format_selection_strikethrough () { - format_selection("~~", "~"); + format_selection ("~~", "~"); } public void format_selection_highlight () { - format_selection("==", ""); + format_selection ("==", ""); } public void insert_link () { @@ -335,7 +335,7 @@ } public void insert_code_span () { - format_selection("`", ""); + format_selection ("`", ""); } public void insert_horizontal_rule () { @@ -389,14 +389,14 @@ } // Since we are now on the end condition, move forward one character as long as // we're not at the very begining of the buffer. - if (!selection_start.is_start()) { - selection_start.forward_char(); + if (!selection_start.is_start ()) { + selection_start.forward_char (); } current_char = selection_end.get_char (); // If we're at the end of line, we're done. if( current_char != '\n') { while (current_char != '\n' && current_char != ' ' && current_char != '\t' && !selection_end.is_end ()) { - selection_end.forward_char(); + selection_end.forward_char (); current_char = selection_end.get_char (); } } diff --git a/core/Widgets/Markdown/MarkdownView.vala b/core/Widgets/Markdown/MarkdownView.vala index ad15d3907..87e3d54be 100644 --- a/core/Widgets/Markdown/MarkdownView.vala +++ b/core/Widgets/Markdown/MarkdownView.vala @@ -122,7 +122,7 @@ public class Widgets.Markdown.View : GtkSource.View { } Gtk.TextIter start; buffer.get_iter_at_line (out start, (int) line); - var str = string.nfill(level - old_title_level, '#'); + var str = string.nfill (level - old_title_level, '#'); buffer.insert (ref start, str, str.length); } else { Gtk.TextIter start; @@ -144,7 +144,7 @@ public class Widgets.Markdown.View : GtkSource.View { public bool check_if_bare_link (string text) { MatchInfo matches; try { - if( is_bare_link.match_full (text, text.length, 0, 0, out matches) ) { + if( is_bare_link.match_full (text, text.length, 0, 0, out matches)) { return true; } } catch (Error e) {} @@ -154,7 +154,7 @@ public class Widgets.Markdown.View : GtkSource.View { public bool check_if_email_link (string text) { MatchInfo matches; try { - if( is_email_link.match_full (text, text.length, 0, 0, out matches) ) { + if (is_email_link.match_full (text, text.length, 0, 0, out matches)) { return true; } } catch (Error e) {} @@ -176,7 +176,7 @@ public class Widgets.Markdown.View : GtkSource.View { link_url = ""; try { - if (is_link.match_full (buffer_text, buffer_text.length, 0, 0, out matches) ) { + if (is_link.match_full (buffer_text, buffer_text.length, 0, 0, out matches)) { do { int start_text_pos, end_text_pos; int start_url_pos, end_url_pos; @@ -188,12 +188,12 @@ public class Widgets.Markdown.View : GtkSource.View { start_text_pos = buffer_text.char_count ((ssize_t) start_text_pos); end_url_pos = buffer_text.char_count ((ssize_t) end_url_pos); - if( cursor_offset <= end_url_pos && cursor_offset >= start_text_pos ) { + if (cursor_offset <= end_url_pos && cursor_offset >= start_text_pos) { found_match = true; link_url = buffer_text.slice (start_url_pos + 1, end_url_pos - 1); } } - } while (matches.next()); + } while (matches.next ()); } } catch (RegexError e) {} @@ -204,7 +204,7 @@ public class Widgets.Markdown.View : GtkSource.View { var buffer = markdown_view.buffer; Regex affix_regex; - switch( affix ) { + switch (affix) { case "**": affix_regex = is_bold_0; break; @@ -249,8 +249,8 @@ public class Widgets.Markdown.View : GtkSource.View { if (affix_regex.match_full (buffer_text, buffer_text.length, 0, 0, out matches) ) { do { int start_before_pos, end_before_pos; - int start_code_pos, end_code_pos; - int start_after_pos, end_after_pos; + int start_code_pos, end_code_pos; + int start_after_pos, end_after_pos; bool have_code_start = matches.fetch_pos (1, out start_before_pos, out end_before_pos); bool have_code = matches.fetch_pos (2, out start_code_pos, out end_code_pos); bool have_code_close = matches.fetch_pos (3, out start_after_pos, out end_after_pos); @@ -265,8 +265,8 @@ public class Widgets.Markdown.View : GtkSource.View { // Convert the character offsets to TextIter's Gtk.TextIter start_before_iter, end_before_iter; - Gtk.TextIter start_code_iter, end_code_iter; - Gtk.TextIter start_after_iter, end_after_iter; + Gtk.TextIter start_code_iter, end_code_iter; + Gtk.TextIter start_after_iter, end_after_iter; buffer.get_iter_at_offset (out start_before_iter, start_before_pos); buffer.get_iter_at_offset (out end_before_iter, end_before_pos); buffer.get_iter_at_offset (out start_code_iter, start_code_pos); @@ -274,7 +274,7 @@ public class Widgets.Markdown.View : GtkSource.View { buffer.get_iter_at_offset (out start_after_iter, start_after_pos); buffer.get_iter_at_offset (out end_after_iter, end_after_pos); - if( cursor_offset <= end_after_pos && cursor_offset >= start_before_pos ) { + if (cursor_offset <= end_after_pos && cursor_offset >= start_before_pos) { // First remove the tag from the text buffer. buffer.remove_tag (buffer.tag_table.lookup ("markdown-bold"), start_before_iter, end_after_iter); @@ -297,7 +297,7 @@ public class Widgets.Markdown.View : GtkSource.View { found_match = true; } } - } while (matches.next()); + } while (matches.next ()); } } catch (Error e) {} @@ -522,7 +522,7 @@ public class Widgets.Markdown.View : GtkSource.View { var bold_f = (last_i - int.min (i, last_i - 1) - 1) / (float) last_i; tag.weight = 600 + (int) (bold_f * 300); var scale_f = (last_i - i) / (float) last_i; - tag.scale = 1.0f + interpolate(scale_f) * 1.4f; + tag.scale = 1.0f + interpolate (scale_f) * 1.4f; if (i == last_i) tag.foreground_rgba = h6_color; tags[i] = tag; @@ -1024,7 +1024,7 @@ public class Widgets.Markdown.View : GtkSource.View { end_pos = buffer_text.char_count ((ssize_t) end_pos); // Convert the character offsets to TextIter's - Gtk.TextIter start_iter, end_iter; + Gtk.TextIter start_iter, end_iter; buffer.get_iter_at_offset (out start_iter, start_pos); buffer.get_iter_at_offset (out end_iter, end_pos); @@ -1055,7 +1055,7 @@ public class Widgets.Markdown.View : GtkSource.View { // Convert the character offsets to TextIter's Gtk.TextIter start_marker_iter, end_marker_iter; - Gtk.TextIter start_full_iter, end_full_iter; + Gtk.TextIter start_full_iter, end_full_iter; buffer.get_iter_at_offset (out start_marker_iter, start_marker_pos); buffer.get_iter_at_offset (out end_marker_iter, end_marker_pos); buffer.get_iter_at_offset (out start_full_iter, start_full_pos); @@ -1183,8 +1183,8 @@ public class Widgets.Markdown.View : GtkSource.View { if (is_code_block.match_full (buffer_text, buffer_text.length, 0, 0, out matches)) { do { int start_before_pos, end_before_pos; - int start_code_pos, end_code_pos; - int start_after_pos, end_after_pos; + int start_code_pos, end_code_pos; + int start_after_pos, end_after_pos; bool have_code_start = matches.fetch_pos (1, out start_before_pos, out end_before_pos); bool have_code = matches.fetch_pos (2, out start_code_pos, out end_code_pos); bool have_code_close = matches.fetch_pos (3, out start_after_pos, out end_after_pos); @@ -1199,8 +1199,8 @@ public class Widgets.Markdown.View : GtkSource.View { // Convert the character offsets to TextIter's Gtk.TextIter start_before_iter, end_before_iter; - Gtk.TextIter start_code_iter, end_code_iter; - Gtk.TextIter start_after_iter, end_after_iter; + Gtk.TextIter start_code_iter, end_code_iter; + Gtk.TextIter start_after_iter, end_after_iter; buffer.get_iter_at_offset (out start_before_iter, start_before_pos); buffer.get_iter_at_offset (out end_before_iter, end_before_pos); buffer.get_iter_at_offset (out start_code_iter, start_code_pos); @@ -1233,8 +1233,8 @@ public class Widgets.Markdown.View : GtkSource.View { if (regex.match_full (buffer_text, buffer_text.length, 0, 0, out matches)) { do { int start_before_pos, end_before_pos; - int start_code_pos, end_code_pos; - int start_after_pos, end_after_pos; + int start_code_pos, end_code_pos; + int start_after_pos, end_after_pos; bool have_code_start = matches.fetch_pos (1, out start_before_pos, out end_before_pos); bool have_code = matches.fetch_pos (2, out start_code_pos, out end_code_pos); bool have_code_close = matches.fetch_pos (3, out start_after_pos, out end_after_pos); @@ -1249,8 +1249,8 @@ public class Widgets.Markdown.View : GtkSource.View { // Convert the character offsets to TextIter's Gtk.TextIter start_before_iter, end_before_iter; - Gtk.TextIter start_code_iter, end_code_iter; - Gtk.TextIter start_after_iter, end_after_iter; + Gtk.TextIter start_code_iter, end_code_iter; + Gtk.TextIter start_after_iter, end_after_iter; buffer.get_iter_at_offset (out start_before_iter, start_before_pos); buffer.get_iter_at_offset (out end_before_iter, end_before_pos); buffer.get_iter_at_offset (out start_code_iter, start_code_pos); @@ -1259,9 +1259,9 @@ public class Widgets.Markdown.View : GtkSource.View { buffer.get_iter_at_offset (out end_after_iter, end_after_pos); // Check to see if the tag has already been applied, if so, skip it. - if (start_code_iter.has_tag (text_tag) && - end_code_iter.has_tag (text_tag) && - start_before_iter.has_tag (text_tag_around) && + if (start_code_iter.has_tag (text_tag) && + end_code_iter.has_tag (text_tag) && + start_before_iter.has_tag (text_tag_around) && start_after_iter.has_tag (text_tag_around) ) { continue; @@ -1289,8 +1289,8 @@ public class Widgets.Markdown.View : GtkSource.View { if (regex.match_full (buffer_text, buffer_text.length, 0, 0, out matches)) { do { int start_before_pos, end_before_pos; - int start_code_pos, end_code_pos; - int start_after_pos, end_after_pos; + int start_code_pos, end_code_pos; + int start_after_pos, end_after_pos; bool have_code_start = matches.fetch_pos (1, out start_before_pos, out end_before_pos); bool have_code = matches.fetch_pos (2, out start_code_pos, out end_code_pos); bool have_code_close = matches.fetch_pos (3, out start_after_pos, out end_after_pos); @@ -1305,8 +1305,8 @@ public class Widgets.Markdown.View : GtkSource.View { // Convert the character offsets to TextIter's Gtk.TextIter start_before_iter, end_before_iter; - Gtk.TextIter start_code_iter, end_code_iter; - Gtk.TextIter start_after_iter, end_after_iter; + Gtk.TextIter start_code_iter, end_code_iter; + Gtk.TextIter start_after_iter, end_after_iter; buffer.get_iter_at_offset (out start_before_iter, start_before_pos); buffer.get_iter_at_offset (out end_before_iter, end_before_pos); buffer.get_iter_at_offset (out start_code_iter, start_code_pos); diff --git a/search-provider/search-provider.vala b/search-provider/search-provider.vala index 3fce1b91e..e3b4a8964 100644 --- a/search-provider/search-provider.vala +++ b/search-provider/search-provider.vala @@ -24,5 +24,4 @@ public class Planify.SearchProvider : Gtk.Application { return true; } - -} \ No newline at end of file +} diff --git a/src/Layouts/ItemSidebarView.vala b/src/Layouts/ItemSidebarView.vala index c1e8dc734..e5c1c6275 100644 --- a/src/Layouts/ItemSidebarView.vala +++ b/src/Layouts/ItemSidebarView.vala @@ -288,7 +288,7 @@ public class Layouts.ItemSidebarView : Adw.Bin { }); } - private void update_content_description() { + private void update_content_description () { if (item.content != content_textview.buffer.text || item.description != current_buffer.get_all_text ().chomp ()) { item.content = content_textview.buffer.text;