about summary refs log tree commit diff stats
path: root/prototypes/browse/24-bold
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-06-05 22:48:52 -0700
committerKartik Agaram <vc@akkartik.com>2020-06-05 22:48:52 -0700
commitee9e20429a75cf97d3786a2fac730b28b0353f86 (patch)
tree1b292e0970aae39635853c8fe4d36be6cc0de96b /prototypes/browse/24-bold
parent0fc0653816b6f8760bf39eeb723dc33a0fc556a0 (diff)
downloadmu-ee9e20429a75cf97d3786a2fac730b28b0353f86.tar.gz
6485
Diffstat (limited to 'prototypes/browse/24-bold')
-rw-r--r--prototypes/browse/24-bold/main.mu14
1 files changed, 9 insertions, 5 deletions
diff --git a/prototypes/browse/24-bold/main.mu b/prototypes/browse/24-bold/main.mu
index 4cb51bd7..8dfc2b9d 100644
--- a/prototypes/browse/24-bold/main.mu
+++ b/prototypes/browse/24-bold/main.mu
@@ -11,7 +11,7 @@ fn main args: (addr array (addr array byte)) -> exit-status/ebx: int {
   var screen-position-state-storage: screen-position-state
   var screen-position-state/eax: (addr screen-position-state) <- address screen-position-state-storage
   init-screen-position-state screen-position-state
-  start-color 0xec, 7  # 236 = darkish gray
+  normal-text
   {
     render fs, screen-position-state
     var key/eax: byte <- read-key
@@ -39,17 +39,16 @@ $render-normal:body: {
     # if (c == EOF) break
     compare c, 0xffffffff  # EOF marker
     break-if-=
-    # if (c == '*') print it and break
+    # if (c == '*') switch to bold
     compare c, 0x2a  # '*'
     {
       break-if-!=
-      start-color 0xec, 7  # 236 = darkish gray
       start-bold
         render-until-asterisk fs, state
-      reset-formatting
-      start-color 0xec, 7  # 236 = darkish gray
+      normal-text
       loop $render-normal:body
     }
+    # if (c == '_') switch to bold
     compare c, 0x5f  # '_'
     {
       break-if-!=
@@ -114,3 +113,8 @@ fn first-arg args-on-stack: (addr array (addr array byte)) -> out/eax: (addr arr
   var result/eax: (addr addr array byte) <- index args, 1
   out <- copy *result
 }
+
+fn normal-text {
+  reset-formatting
+  start-color 0xec, 7  # 236 = darkish gray
+}