merged client_test from libtorrent_aio

This commit is contained in:
Arvid Norberg 2012-10-06 14:04:24 +00:00
parent 24103c6603
commit 84ccb31a6d
1 changed files with 15 additions and 2 deletions

View File

@ -1870,6 +1870,8 @@ int main(int argc, char* argv[])
}
#endif
int max_lines = terminal_height - 15;
// loop through the alert queue to see if anything has happened.
std::deque<alert*> alerts;
ses.pop_alerts(&alerts);
@ -1928,7 +1930,7 @@ int main(int argc, char* argv[])
for (std::vector<feed_handle>::iterator i = feeds.begin()
, end(feeds.end()); i != end; ++i)
{
if (lines_printed >= terminal_height - 15)
if (lines_printed >= max_lines)
{
out += "...\n";
break;
@ -1948,10 +1950,21 @@ int main(int argc, char* argv[])
}
}
// handle scrolling down when moving the cursor
// below the fold
int start_offset = 0;
if (active_torrent >= max_lines - lines_printed)
start_offset = active_torrent - max_lines + lines_printed + 1;
for (std::vector<torrent_status const*>::iterator i = filtered_handles.begin();
i != filtered_handles.end(); ++torrent_index)
{
if (lines_printed >= terminal_height - 15)
if (torrent_index < start_offset)
{
++i;
continue;
}
if (lines_printed >= max_lines)
{
out += "...\n";
break;