fix bugs in filter

This commit is contained in:
Kirigaya Kazuto 2018-11-19 17:59:39 +08:00
parent 01b396e8c4
commit 971314d6cc

View File

@ -7,7 +7,7 @@ local term=require('term')
local shell=require('shell')
require('libevent')
local version_tag="Smart Storage v0.5.3"
local version_tag="Smart Storage v0.5.4"
print(version_tag)
print("Checking hardware...")
@ -153,10 +153,14 @@ local function display(tb_data,tb_display,begin_at,filter)
local count_shown=0
for i=begin_at,#tb_display,1 do
local this_table=tb_data[tb_display[i]]
if(string.find(this_table.name,filter)~=nil) then
if(filter==nil or string.len(filter)<1 or string.find(this_table.name,filter)~=nil) then
local old=gpu.setForeground(0xFFFF00)
gpu.set(1,i-begin_at+3,this_table.name .. " -- " .. this_table.label .. " (" .. this_table.total .. ")")
gpu.setForeground(old)
else
gpu.set(1,i-begin_at+3,this_table.name .. " -- " .. this_table.label .. " (" .. this_table.total .. ")")
count_shown=count_shown+1
end
count_shown=count_shown+1
if(i-begin_at+3>=h-3) then break end
end