Skip to content

Commit 44c2da0

Browse files
committed
Support no args code view claims
1 parent f2af9a5 commit 44c2da0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

virtual-programs/code-view.folk

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
namespace eval ::codeView {
22
# TODO: also don't hardcode this? Or make it in meters once that's simple
33
variable marginInPx 10
4+
variable defaults { widthScale 1 heightScale 1 textScale 0.6 }
45

56
proc getEmAndAdvance {textScale} {
67
set em [expr {$textScale * 25}]
@@ -32,10 +33,13 @@ namespace eval ::codeView {
3233
}
3334
}
3435

36+
When /someone/ claims /view/ is a code view {
37+
Claim $view is a code view with {*}$codeView::defaults
38+
}
39+
3540
# initial setup
3641
When /view/ is a code view with /...options/ {
37-
set defaults { widthScale 1 heightScale 1 textScale 0.6 }
38-
set options [dict merge $defaults $options]
42+
set options [dict merge $codeView::defaults $options]
3943

4044
# select which program the view is viewing
4145
When $view points up at /program/ {

0 commit comments

Comments
 (0)