mirror of
https://github.com/tstack/lnav
synced 2024-11-03 23:15:38 +00:00
[search] start searching a couple thousand lines before the top
This commit is contained in:
parent
c18850aa01
commit
cc7cba6514
@ -44,7 +44,7 @@
|
||||
template<typename T, class DISTINCT>
|
||||
class strong_int {
|
||||
public:
|
||||
explicit constexpr strong_int(T v = 0) : value(v) { };
|
||||
explicit constexpr strong_int(T v = 0) noexcept : value(v) { };
|
||||
operator const T &() const { return this->value; };
|
||||
strong_int operator+(const strong_int &rhs)
|
||||
{
|
||||
@ -72,17 +72,17 @@ public:
|
||||
this->value -= rhs.value;
|
||||
return *this;
|
||||
};
|
||||
strong_int &operator-(void)
|
||||
strong_int &operator-()
|
||||
{
|
||||
this->value = -this->value;
|
||||
return *this;
|
||||
};
|
||||
strong_int &operator++(void) { this->value++; return *this; };
|
||||
strong_int &operator--(void) { this->value--; return *this; };
|
||||
strong_int &operator++() { this->value++; return *this; };
|
||||
strong_int &operator--() { this->value--; return *this; };
|
||||
bool operator==(const strong_int &rhs) const {
|
||||
return this->value == rhs.value;
|
||||
};
|
||||
T *out(void) { return &this->value; };
|
||||
T *out() { return &this->value; };
|
||||
private:
|
||||
T value;
|
||||
};
|
||||
|
@ -44,6 +44,8 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
const auto REVERSE_SEARCH_OFFSET = 2000_vl;
|
||||
|
||||
void
|
||||
text_filter::revert_to_last(logfile_filter_state &lfs, size_t rollback_size)
|
||||
{
|
||||
@ -470,9 +472,15 @@ void textview_curses::execute_search(const std::string ®ex_orig)
|
||||
unique_ptr<grep_proc<vis_line_t>> gp = make_unique<grep_proc<vis_line_t>>(code, *this);
|
||||
|
||||
gp->set_sink(this);
|
||||
gp->queue_request(this->get_top());
|
||||
if (this->get_top() > 0) {
|
||||
gp->queue_request(0_vl, this->get_top());
|
||||
auto top = this->get_top();
|
||||
if (top < REVERSE_SEARCH_OFFSET) {
|
||||
top = 0_vl;
|
||||
} else {
|
||||
top -= REVERSE_SEARCH_OFFSET;
|
||||
}
|
||||
gp->queue_request(top);
|
||||
if (top > 0) {
|
||||
gp->queue_request(0_vl, top);
|
||||
}
|
||||
gp->start();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user