support scrolling for text files

pull/37/merge
Tim Stack 14 years ago
parent 6ae8968d03
commit 6909203c6d

@ -39,8 +39,7 @@ LDADD = \
$(HELP_O) \
$(SQLITE3_LIBS) \
$(PCRE_LIBS) \
-lpcrecpp \
-lgpm
-lpcrecpp
noinst_HEADERS = \
auto_fd.hh \

@ -226,8 +226,7 @@ LDADD = \
$(HELP_O) \
$(SQLITE3_LIBS) \
$(PCRE_LIBS) \
-lpcrecpp \
-lgpm
-lpcrecpp
noinst_HEADERS = \
auto_fd.hh \

@ -20,8 +20,6 @@ static const size_t DEFAULT_LINE_BUFFER_SIZE = 256 * 1024;
static const size_t MAX_LINE_BUFFER_SIZE = 2 * DEFAULT_LINE_BUFFER_SIZE;
static const size_t DEFAULT_INCREMENT = 1024;
static set<line_buffer *> ALL_BUFFERS;
/*
* XXX REMOVE ME
*
@ -86,8 +84,6 @@ line_buffer::line_buffer()
throw bad_alloc();
}
ALL_BUFFERS.insert(this);
assert(this->invariant());
}
@ -96,8 +92,6 @@ line_buffer::~line_buffer()
auto_fd fd = -1;
this->set_fd(fd);
ALL_BUFFERS.erase(this);
}
void line_buffer::set_fd(auto_fd &fd)

@ -380,6 +380,7 @@ static void rebuild_indexes(bool force)
logfile_sub_source &lss = lnav_data.ld_log_source;
textview_curses &log_view = lnav_data.ld_views[LNV_LOG];
textview_curses &text_view = lnav_data.ld_views[LNV_TEXT];
vis_line_t old_bottom(0), height(0);
unsigned long width;
@ -390,6 +391,11 @@ static void rebuild_indexes(bool force)
{
textfile_sub_source *tss = &lnav_data.ld_text_source;
std::list<logfile *>::iterator iter;
size_t new_count;
text_view.get_dimensions(height, width);
old_bottom = text_view.get_top() + height;
scroll_down = (size_t)old_bottom > tss->text_line_count();
for (iter = tss->tss_files.begin();
iter != tss->tss_files.end();) {
@ -405,6 +411,13 @@ static void rebuild_indexes(bool force)
++iter;
}
}
text_view.reload_data();
new_count = tss->text_line_count();
if (scroll_down && new_count >= (size_t)height) {
text_view.set_top(vis_line_t(new_count - height + 1));
}
}
old_time = lnav_data.ld_top_time;

Loading…
Cancel
Save