[hist] need to rebuild hist to reflect marks

Defect Number:
    Reviewed By:
   Testing Done:
pull/111/merge
Timothy Stack 7 years ago
parent 7033b51b41
commit aa21234164

@ -464,7 +464,7 @@ private:
textview_curses &hid_view;
};
void rebuild_hist(size_t old_count, bool force)
void rebuild_hist()
{
logfile_sub_source &lss = lnav_data.ld_log_source;
hist_source2 &hs = lnav_data.ld_hist_source2;
@ -868,6 +868,10 @@ bool toggle_view(textview_curses *toggle_tc)
else if (toggle_tc == &lnav_data.ld_views[LNV_PRETTY]) {
open_pretty_view();
}
else if (toggle_tc == &lnav_data.ld_views[LNV_HISTOGRAM]) {
// Rebuild to reflect changes in marks.
rebuild_hist();
}
lnav_data.ld_last_view = NULL;
lnav_data.ld_view_stack.push_back(toggle_tc);
retval = true;

@ -327,7 +327,7 @@ extern const ssize_t ZOOM_COUNT;
#define HELP_MSG_2(x, y, msg) \
"Press " ANSI_BOLD(#x) "/" ANSI_BOLD(#y) " " msg
void rebuild_hist(size_t old_count, bool force);
void rebuild_hist();
void rebuild_indexes(bool force);
bool ensure_view(textview_curses *expected_tc);

@ -2219,7 +2219,7 @@ static string com_zoom_to(exec_context &ec, string cmdline, vector<string> &args
if (hist_view.get_inner_height() > 0) {
old_time = lnav_data.ld_hist_source2.time_for_row(
lnav_data.ld_views[LNV_HISTOGRAM].get_top());
rebuild_hist(0, true);
rebuild_hist();
lnav_data.ld_views[LNV_HISTOGRAM].set_top(
vis_line_t(
lnav_data.ld_hist_source2.row_for_time(old_time)));

@ -750,6 +750,17 @@ check_output "histogram is not working?" <<EOF
Sat Nov 03 08:00:00 1 normal 0 errors 0 warnings 0 marks
EOF
run_test ${lnav_test} -n \
-c ":goto 0" \
-c ":mark" \
-c ":switch-to-view histogram" \
${test_dir}/logfile_syslog.0
check_output "histogram is not working?" <<EOF
Sat Nov 03 09:20:00 1 normal 2 errors 0 warnings 1 marks
Sat Nov 03 09:45:00 1 normal 0 errors 0 warnings 0 marks
EOF
run_test ${lnav_test} -n \
-c ":zoom-to bad" \
${test_dir}/logfile_access_log.0

Loading…
Cancel
Save