def NcursesInterface::find_entry(win, direction = 1)
if win && win.items && win.items.size > 0
str = NcursesInterface::get_input('find_entry')
if ((str && str.size > 0) || ($last_search && $last_search.size > 0))
new_index = -1
str = $last_search unless str && str.size > 0
regex = /#{str}/i
(win.active_item + 1).upto(win.items.size - 1) { |i|
if win.items[i]['title'] =~ regex
new_index = i
break
end
}
if new_index < 0
0.upto(win.active_item - 1) { |i|
if win.items[i]['title'] =~ regex
new_index = i
break
end
}
end
if new_index >= 0
win.activate new_index
else
NcursesInterface::set_status($config['msg_find_nomatches'])
end
$last_search = str
end
end
end