about summary refs log tree commit diff stats
path: root/apps
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-05-30 23:34:37 -0700
committerKartik Agaram <vc@akkartik.com>2020-05-30 23:34:37 -0700
commit2bd7b69298d3038bd359f31380e5e61dea8c142f (patch)
treeb054dc9cf2c10ae6b92633c62d05cff86907aaa2 /apps
parent7134bfa24fdbd9fe9e2a57d91941052797ddd6c7 (diff)
downloadmu-2bd7b69298d3038bd359f31380e5e61dea8c142f.tar.gz
6452
Support more than two states.
Diffstat (limited to 'apps')
-rw-r--r--apps/browse.mu13
1 files changed, 7 insertions, 6 deletions
diff --git a/apps/browse.mu b/apps/browse.mu
index 62079194..8009732e 100644
--- a/apps/browse.mu
+++ b/apps/browse.mu
@@ -26,7 +26,7 @@ fn main args: (addr array (addr array byte)) -> exit-status/ebx: int {
 }
 
 type render-state {
-  current-state: int  # enum 0: normal, 1: bold
+  current-state: int  # enum 0: normal, 1: bold, 2: heading
 }
 
 # decide how to lay out pages on screen
@@ -84,7 +84,7 @@ $update-attributes:check-state: {
           compare c, 0x2a  # '*'
           {
             break-if-!=
-            # r->current-state == 0 && c == '*'
+            # r->current-state == 0 && c == '*' => bold text
             start-bold
             copy-to *state, 1
             break $update-attributes:check-state
@@ -92,21 +92,22 @@ $update-attributes:check-state: {
           compare c, 0x5f  # '_'
           {
             break-if-!=
-            # r->current-state == 0 && c == '_'
+            # r->current-state == 0 && c == '_' => bold text
             start-bold
             copy-to *state, 1
             break $update-attributes:check-state
           }
           break $update-attributes:check-state
         }
+        compare *state, 1  # bold
         {
-          break-if-=
+          break-if-!=
           compare c, 0x2a  # '*'
           {
             break-if-!=
+            # r->current-state == 1 && c == '*' => print c, then normal text
             print-byte c
             col <- increment
-            # r->current-state == 1 && c == '*'
             reset-formatting
             start-color 0xec, 7  # 236 = darkish gray
             copy-to *state, 0
@@ -117,7 +118,7 @@ $update-attributes:check-state: {
             break-if-!=
             print-byte c
             col <- increment
-            # r->current-state == 1 && c == '_'
+            # r->current-state == 1 && c == '_' => print c, then normal text
             reset-formatting
             start-color 0xec, 7  # 236 = darkish gray
             copy-to *state, 0