Fix rendering of lines between columns

db4
Slava Pestov 2009-01-12 19:32:10 -06:00
parent 27fd669021
commit 0829d8ae93
1 changed files with 7 additions and 7 deletions

View File

@ -41,14 +41,11 @@ focused? ;
: line-height ( table -- n )
font>> open-font "" string-height ;
CONSTANT: table-gap 5
CONSTANT: table-gap 6
: table-rows ( table -- rows )
[ control-value ] [ renderer>> ] bi '[ _ row-columns ] map ;
: column-offsets ( table -- xs )
0 [ table-gap + + ] accumulate nip ;
: (compute-column-widths) ( font rows -- total widths )
[ drop 0 { } ] [
tuck [ first length 0 <repetition> ] 2dip
@ -101,13 +98,16 @@ M: table layout*
: draw-moused ( table -- )
[ ] [ mouse-index>> ] [ mouse-color>> ] tri f highlight-row ;
: column-lines ( widths -- xs )
0 [ + ] accumulate nip rest-slice ; inline
: column-offsets ( table -- xs )
0 [ table-gap + + ] accumulate nip ;
: column-line-offsets ( table -- xs )
column-offsets rest-slice [ table-gap 2/ - ] map ;
: draw-columns ( table -- )
[ column-line-color>> gl-color ]
[
[ column-widths>> column-lines ] [ dim>> second ] bi
[ column-widths>> column-line-offsets ] [ dim>> second ] bi
'[ [ 0 2array ] [ _ 2array ] bi gl-line ] each
] bi ;