shithub: orca

Download patch

ref: 42e615816b9f71934969162b88fb91e1d39fb038
parent: f03d2411f64e46fcca59f898c530189c6d756f28
author: cancel <cancel@cancel.fm>
date: Fri Nov 30 06:19:02 EST 2018

Add '#'

--- a/sim.c
+++ b/sim.c
@@ -254,7 +254,9 @@
 
 //////// Operators
 
-#define ORCA_SOLO_OPERATORS(_) _('*', bang)
+#define ORCA_SOLO_OPERATORS(_)                                                 \
+  _('#', comment)                                                              \
+  _('*', bang)
 
 #define ORCA_DUAL_OPERATORS(_)                                                 \
   _('N', 'n', north)                                                           \
@@ -296,6 +298,21 @@
   END_HASTE
 END_PHASE
 BEGIN_SOLO_PHASE_1(bang)
+END_PHASE
+
+BEGIN_SOLO_PHASE_0(comment)
+  if (!IS_AWAKE)
+    return;
+  Glyph* line = gbuffer + y * width;
+  Usz max_x = width < 255 ? width : 255;
+  for (Usz x0 = x + 1; x0 < max_x; ++x0) {
+    Glyph g = line[x0];
+    mbuffer_poke_flags_or(mbuffer, height, width, y, x0, Mark_flag_lock);
+    if (g == '#')
+      break;
+  }
+END_PHASE
+BEGIN_SOLO_PHASE_1(comment)
 END_PHASE
 
 BEGIN_DUAL_PHASE_0(add)