Skip to content

Commit

Permalink
refactor: cleanup
Browse files Browse the repository at this point in the history
* Use fix for match statement instead of if else casting.
  Match doesn't reached it's full capacity yet, since comma separation
  won't work correctly atm.
* Use inform file naming.
  • Loading branch information
ttytm committed Jun 20, 2023
1 parent 4b8ba41 commit 0dce2bd
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 24 deletions.
51 changes: 27 additions & 24 deletions src/_instructions_multi_bars.v → src/_instructions_multi.v
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,37 @@ import time
import sync

fn watch_(mut bars MultiBarType, mut wg sync.WaitGroup) {
// NOTE: Same operation for Bars and SmoothBars (re-check with V's progression if this can be grouped).
// Tested match statements and alias types for arrays with bar references.
if mut bars is []&Bar {
for mut b in bars {
b.multi = true
b.setup()
}
time.sleep(time.millisecond * 15)
for {
if bars.draw() {
term.show_cursor()
break
// NOTE: Operation for Bars and SmoothBars can be grouped potentially
// (comma separation won't work atm. Re-check with V's progression).
match mut bars {
[]&Bar {
for mut b in bars {
b.multi = true
b.setup()
}
// Slow down redraw loop interval to reduce load.
time.sleep(time.millisecond * 15)
for {
if bars.draw() {
term.show_cursor()
break
}
// Slow down redraw loop interval to reduce load.
time.sleep(time.millisecond * 15)
}
}
} else if mut bars is []&SmoothBar {
for mut b in bars {
b.multi = true
b.setup()
}
for {
if bars.draw() {
term.show_cursor()
break
[]&SmoothBar {
for mut b in bars {
b.multi = true
b.setup()
}
for {
if bars.draw() {
term.show_cursor()
break
}
// Slow down redraw loop interval to reduce load.
time.sleep(time.millisecond * 5)
}
// Slow down redraw loop interval to reduce load.
time.sleep(time.millisecond * 5)
}
}
wg.done()
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 0dce2bd

Please sign in to comment.