Skip to content

Instantly share code, notes, and snippets.

@alex-ilin
Last active June 9, 2017 00:12
Show Gist options
  • Save alex-ilin/f453f86594e61741b14c0492084cfbe8 to your computer and use it in GitHub Desktop.
Save alex-ilin/f453f86594e61741b14c0492084cfbe8 to your computer and use it in GitHub Desktop.
More complicated code, but no intermediate arrays
: first-column-width ( table model -- width )
[
[ font>> dup ] keep
renderer>> column-titles first cell-dim nip +
] dip
value>> dup sequence? [
length 1 - unparse-short swapd cell-dim nip + max
] [
make-mirror [
! font prev key value
drop unparse-short [ over ] dip cell-dim nip + max
] assoc-each nip
] if ;
: <inspector-table> ( model -- table )
[
[ make-slot-descriptions ] <arrow> inspector-renderer <table>
[ invoke-primary-operation ] >>action
line-color >>column-line-color
6 >>gap
15 >>min-rows
15 >>max-rows
40 >>min-cols
40 >>max-cols
monospace-font >>font
dup
] keep first-column-width 0 2array >>fixed-column-widths ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment