bin/dtas-console in dtas-0.16.1 vs bin/dtas-console in dtas-0.17.0
- old
+ new
@@ -51,12 +51,10 @@
prec_max = prec_step.size - 1
tfmt = update_tfmt(prec_step[prec_nr], tsec)
events = []
interval = 1.0 / 10 ** prec_nr
-pause = nil
-
def show_events(lineno, screen, events)
Curses.setpos(lineno += 1, 0)
Curses.clrtoeol
Curses.addstr('Events:')
maxy = screen.maxy - 1
@@ -119,11 +117,10 @@
end
pre_mute_vol = 1.0
enc_locale = Encoding.find("locale")
$stdout.set_encoding(enc_locale)
-enc_opts = { undef: :replace, invalid: :replace, replace: '?' }
begin
Curses.init_screen
Curses.nonl
Curses.cbreak
Curses.noecho
@@ -133,11 +130,10 @@
loop do
lineno = -1
pfmt = cur['format']
elapsed = samples = 0
fmt = total = ''
- paused = false
if current = cur['current']
infile = current['infile'] || current['command']
elapsed = DTAS.now - current['spawn_at']
if (nr = cur['current_initial']) && (current_format = current['format'])
rate = current_format['rate'].to_f
@@ -148,11 +144,10 @@
fmt = fmt_to_s(pfmt)
fmt = "(#{fmt} > #{fmt})"
end
elsif cur['paused'] && infile = cur['current_paused']
fmt = "[paused] (#{fmt_to_s(pfmt)})"
- paused = true
infile = infile['command'] if Hash === infile
if Array === infile
infile, elapsed = infile
elapsed = elapsed.to_i
samples = rate = 0
@@ -167,11 +162,12 @@
if infile
# FS encoding != locale encoding, but we need to display an FS path
# name to whatever locale the terminal is encoded to, so force it
# and risk mojibake...
- infile.encode(enc_locale, enc_opts)
+ infile.encode(enc_locale,
+ undef: :replace, invalid: :replace, replace: '?')
Curses.setpos(lineno += 1, 0)
Curses.clrtoeol
Curses.addstr(infile)
total = " [#{Time.at(samples / rate).utc.strftime(tfmt)}]" if samples != 0
Curses.setpos(lineno += 1, 0)
@@ -218,13 +214,12 @@
when w
event = w.res_wait
case event
when "pause"
if current
- pause = current['infile'] || current['command']
+ current['infile'] || current['command']
end
when %r{\Afile }
- pause = nil
end
events << "#{Time.now.strftime(tfmt)} #{event}"
# something happened, refresh current
# we could be more intelligent here, maybe, but too much work.
cur = YAML.load(c.req('current'))