refactor tab bar

This commit is contained in:
Nico 2021-04-23 12:02:08 +01:00
parent 75cc5ec09e
commit 07ad405461
1 changed files with 8 additions and 7 deletions

15
main.fs
View File

@ -251,7 +251,13 @@ S" you feel like throwing some stuff into the pool." set-message
\ draw-tab-devices draws the device count on the tab bar
: draw-tab-devices
devices f@ f>s dup ." [" .
1 = if ." Device ]" else ." Devices] " then ;
1 = if ." Device]" else ." Devices] " then ;
\ draw-tab draws a single tab for a screen
: draw-tab ( i -- )
dup screen @ = if
." >" bl
drop then draw-screen-name ;
\ draw-tab-bar draws the tab bar. TODO make this into smaller words
: draw-tab-bar ( x y -- x y )
@ -259,12 +265,7 @@ S" you feel like throwing some stuff into the pool." set-message
clear-line
screens @ if \ 0 is false in forth, so if the number of screens is zero, don't draw the bar.
screens @ 1+ 0 do
i dup
screen @ = if
." >" bl
drop
then
draw-screen-name
i dup draw-tab
loop inc-y
draw-tab-keys
draw-tab-devices