commit a33ed2faaf243e8b97c25bbcd0fd5aec43b6ab26
parent 1841ea0ef4fd696757299c1a7d4a97fc57a9a4f3
Author: Skylar Hill <stellarskylark@posteo.net>
Date: Sun, 5 Jun 2022 19:25:00 -0500
Refactor help display for easier editing
Diffstat:
M | src/tui.nim | | | 47 | ++++++++++++++++++++++++++--------------------- |
1 file changed, 26 insertions(+), 21 deletions(-)
diff --git a/src/tui.nim b/src/tui.nim
@@ -159,27 +159,32 @@ proc drawHelp(): void =
var bb = newBoxBuffer(tb.width, tb.height)
bb.drawRect(1, 0, tb.width - 1, tb.height - 1)
tb.write(bb)
- tb.write(2, 1, "Press Q to exit help.")
- tb.write(2, 2, "")
- tb.write(2, 3, "h Select window to the left")
- tb.write(2, 4, "l Select window to the right")
- tb.write(2, 5, "j Select next item in window")
- tb.write(2, 6, "k Select previous item in window")
- tb.write(2, 7, "e Edit selected item")
- tb.write(2, 8, "Enter Roll selected item")
- tb.write(2, 9, "] Scroll description forward")
- tb.write(2, 10, "[ Scroll description backward")
- tb.write(2, 11, "= Increase item value by 1 (if hardcoded integer)")
- tb.write(2, 12, "- Decrease item value by 1 (if hardcoded integer)")
- tb.write(2, 13, "+ Increase item value by 10 (if hardcoded integer)")
- tb.write(2, 14, "_ Decrease item value by 10 (if hardcoded integer)")
- tb.write(2, 15, "J/Tab Switch to next tab")
- tb.write(2, 16, "K Switch to previous tab")
- tb.write(2, 17, ": Run a command")
- tb.write(2, 18, " :r[oll] <expression>")
- tb.write(2, 19, " Roll a dice expression or item in your character sheet.")
- tb.write(2, 20, " :w[rite] [optional-path]")
- tb.write(2, 21, " Overwrite the current character sheet, or write to the given path.")
+
+ let help = """
+Press Q to exit help.
+
+h Select window to the left
+l Select window to the right
+j Select next item in window
+k Select previous item in window
+e Edit selected item
+Enter Roll selected item
+] Scroll description forward
+"[ Scroll description backward
+= Increase item value by 1 (if hardcoded integer)
+- Decrease item value by 1 (if hardcoded integer)
++ Increase item value by 10 (if hardcoded integer)
+_ Decrease item value by 10 (if hardcoded integer)
+J/Tab Switch to next tab
+K Switch to previous tab
+: Run a command
+ :r[oll] <expression>
+ Roll a dice expression or item in your character sheet.
+ :w[rite] [optional-path]
+ Overwrite the current character sheet, or write to the given path."""
+ let lines = help.splitLines
+ for i in 0..lines.high:
+ tb.write(2, 1+i, lines[i])
tb.display()
sleep(20)