diff --git a/src/Makefile.am b/src/Makefile.am index 4ffe56ea..df4ca793 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -39,8 +39,7 @@ LDADD = \ $(HELP_O) \ $(SQLITE3_LIBS) \ $(PCRE_LIBS) \ - -lpcrecpp \ - -lgpm + -lpcrecpp noinst_HEADERS = \ auto_fd.hh \ diff --git a/src/Makefile.in b/src/Makefile.in index 8e15ada2..7dc44b35 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -226,8 +226,7 @@ LDADD = \ $(HELP_O) \ $(SQLITE3_LIBS) \ $(PCRE_LIBS) \ - -lpcrecpp \ - -lgpm + -lpcrecpp noinst_HEADERS = \ auto_fd.hh \ diff --git a/src/line_buffer.cc b/src/line_buffer.cc index 89124fdd..7cd2c551 100644 --- a/src/line_buffer.cc +++ b/src/line_buffer.cc @@ -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 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) diff --git a/src/lnav.cc b/src/lnav.cc index d6e65fd6..37888dbf 100644 --- a/src/lnav.cc +++ b/src/lnav.cc @@ -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::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;