update screen periodically and display more data when data becomes available
| 1655 | |
| 1656 | // update screen periodically and display more data when data becomes available |
| 1657 | bool Query::update() |
| 1658 | { |
| 1659 | int begin = rows_; |
| 1660 | |
| 1661 | // fetch viewable portion plus one up to two screenfuls more |
| 1662 | fetch(row_ - (row_ % Screen::rows) + 2 * Screen::rows); |
| 1663 | |
| 1664 | int end = rows_ + append_; |
| 1665 | |
| 1666 | // display the viewable portion when updated |
| 1667 | if (end > begin && begin < row_ + maxrows_ - 2) |
| 1668 | { |
| 1669 | Screen::normal(); |
| 1670 | |
| 1671 | if (begin + maxrows_ - 2 > end) |
| 1672 | begin = end - maxrows_ + 2; |
| 1673 | if (begin < 0) |
| 1674 | begin = 0; |
| 1675 | if (begin < row_) |
| 1676 | begin = row_; |
| 1677 | |
| 1678 | for (int i = begin; i < std::min(end, row_ + maxrows_ - 2); ++i) |
| 1679 | disp(i); |
| 1680 | } |
| 1681 | |
| 1682 | if (error_ == -1) |
| 1683 | { |
| 1684 | if (tick_ < 8 && end < row_ + maxrows_ - 2) |
| 1685 | { |
| 1686 | int row = end - row_ + 1; |
| 1687 | |
| 1688 | // no dots and clear below when we hit eof |
| 1689 | if (eof_) |
| 1690 | tick_ = 4; |
| 1691 | |
| 1692 | Screen::setpos(row, 0); |
| 1693 | if (tick_ < 4) |
| 1694 | { |
| 1695 | Screen::normal(); |
| 1696 | if (tick_ == 0) |
| 1697 | Screen::erase(); |
| 1698 | else |
| 1699 | Screen::put(&"..."[3 - tick_]); |
| 1700 | } |
| 1701 | else if (tick_ == 4) |
| 1702 | { |
| 1703 | // clear elipsis and below |
| 1704 | if (flag_split) |
| 1705 | { |
| 1706 | if (eof_) |
| 1707 | { |
| 1708 | redraw(); |
| 1709 | } |
| 1710 | else |
| 1711 | { |
| 1712 | // clear top half below last row |
| 1713 | for (int i = rows_; i < maxrows_ - 1; ++i) |
| 1714 | disp(i); |
nothing calls this directly
no outgoing calls
no test coverage detected