File f5e8da83f958797157423dc23818e6ebd6681d20.patch of Package minder

From f5e8da83f958797157423dc23818e6ebd6681d20 Mon Sep 17 00:00:00 2001
From: Trevor Williams <phase1geo@gmail.com>
Date: Tue, 7 Dec 2021 22:08:13 -0600
Subject: [PATCH] Fixing compile issues and adding strikethru Markdown syntax
 support in nodes.

---
 src/DrawArea.vala               | 27 +++++++++++++++------------
 src/parsers/MarkdownParser.vala |  9 +++++++++
 2 files changed, 24 insertions(+), 12 deletions(-)

diff --git a/src/DrawArea.vala b/src/DrawArea.vala
index 7cd99c43..35368ed4 100644
--- a/src/DrawArea.vala
+++ b/src/DrawArea.vala
@@ -433,19 +433,22 @@ public class DrawArea : Gtk.DrawingArea {
   }
 
   /* Sets the cursor of the drawing area */
-  private void set_cursor( CursorType? type = null ) {
+  private void set_cursor( CursorType type ) {
 
-    var     win    = get_window();
-    Cursor? cursor = win.get_cursor();
+    var win    = get_window();
+    var cursor = win.get_cursor();
 
-    if( type == null ) {
-      win.set_cursor( null );
-    } else if( (cursor == null) || (cursor.cursor_type != type) ) {
+    if( (cursor == null) || (cursor.cursor_type != type) ) {
       win.set_cursor( new Cursor.for_display( get_display(), type ) );
     }
 
   }
 
+  /* Resets the cursor to the standard one */
+  private void reset_cursor() {
+    get_window().set_cursor( null );
+  }
+
   /* Sets the cursor of the drawing area to the named cursor */
   private void set_cursor_from_name( string name ) {
     var win = get_window();
@@ -850,7 +853,7 @@ public class DrawArea : Gtk.DrawingArea {
       _im_context.reset();
       _im_context.focus_out();
       if( node.name.is_within( _scaled_x, _scaled_y ) ) {
-        set_cursor( null );
+        reset_cursor();
       }
       undo_text.clear();
       if( undo_text.do_undo ) {
@@ -880,7 +883,7 @@ public class DrawArea : Gtk.DrawingArea {
       _im_context.reset();
       _im_context.focus_out();
       if( (conn.title != null) && conn.title.is_within( _scaled_x, _scaled_y ) ) {
-        set_cursor( null );
+        reset_cursor();
       }
       undo_text.clear();
       if( undo_text.do_undo ) {
@@ -2417,7 +2420,7 @@ public class DrawArea : Gtk.DrawingArea {
               match.show_fold = true;
               queue_draw();
             }
-            set_cursor( null );
+            reset_cursor();
             set_tooltip_markup( null );
             select_node_on_hover( match, shift );
           }
@@ -2427,7 +2430,7 @@ public class DrawArea : Gtk.DrawingArea {
 
 
       update_last_match( null );
-      set_cursor( null );
+      reset_cursor();
       set_tooltip_markup( null );
       select_sticker_group_on_hover( shift );
 
@@ -2535,7 +2538,7 @@ public class DrawArea : Gtk.DrawingArea {
 
     /* Return the cursor to the default cursor */
     if( _motion ) {
-      set_cursor( null );
+      reset_cursor();
     }
 
     /* If we were resizing a node, end the resize */
@@ -4314,7 +4317,7 @@ public class DrawArea : Gtk.DrawingArea {
             set_cursor( url_cursor );
             set_tooltip_markup( url );
           } else {
-            set_cursor( null );
+            reset_cursor();
             set_tooltip_markup( null );
           }
         }
diff --git a/src/parsers/MarkdownParser.vala b/src/parsers/MarkdownParser.vala
index 2feaedf5..b3efa308 100644
--- a/src/parsers/MarkdownParser.vala
+++ b/src/parsers/MarkdownParser.vala
@@ -52,6 +52,9 @@ public class MarkdownParser : TextParser {
     add_regex( "(?<!_)(_)([^_ \t].*?(?<!\\\\|_| |\\t))(_)(?!_)", highlight_italics );
     add_regex( "(?<!\\*)(\\*)([^* \t].*?(?<!\\\\|\\*| |\\t))(\\*)(?!\\*)", highlight_italics );
 
+    /* Strikethrough */
+    add_regex( "(~~)([^~ \t].*?(?<!\\\\|~| |\\t))(~~)", highlight_strikethrough );
+
     /* Links */
     add_regex( "(\\[)(.+?)(\\]\\s*\\((\\S+).*\\))", highlight_url1 );
     add_regex( "(<)((mailto:)?[a-z0-9.-]+@[-a-z0-9]+(\\.[-a-z0-9]+)*\\.[a-z]+)(>)", highlight_url2 );
@@ -84,6 +87,12 @@ public class MarkdownParser : TextParser {
     make_grey( text, match, 3 );
   }
 
+  private void highlight_strikethrough( FormattedText text, MatchInfo match ) {
+    make_grey( text, match, 1 );
+    add_tag( text, match, 2, FormatTag.STRIKETHRU );
+    make_grey( text, match, 3 );
+  }
+
   private void highlight_url1( FormattedText text, MatchInfo match ) {
     make_grey( text, match, 1 );
     add_tag( text, match, 2, FormatTag.URL, get_text( match, 4 ) );
openSUSE Build Service is sponsored by