Use selected line instead of top

pull/1090/head
Florian Münchbach 2 years ago
parent e5f7e5c8c5
commit 7f8b031b83

@ -57,7 +57,7 @@ field_overlay_source::build_field_lines(const listview_curses& lv)
return;
}
content_line_t cl = lss.at(lv.get_top());
content_line_t cl = lss.at(lv.get_selection());
std::shared_ptr<logfile> file = lss.find(cl);
auto ll = file->begin() + cl;
auto format = file->get_format();
@ -72,13 +72,13 @@ field_overlay_source::build_field_lines(const listview_curses& lv)
display = display || this->fos_contexts.top().c_show;
}
this->build_meta_line(lv, this->fos_lines, lv.get_top());
this->build_meta_line(lv, this->fos_lines, lv.get_selection());
if (!display) {
return;
}
if (!this->fos_log_helper.parse_line(lv.get_top())) {
if (!this->fos_log_helper.parse_line(lv.get_selection())) {
return;
}

@ -338,7 +338,12 @@ handle_paging_key(int ch)
case 'F':
if (tc == &lnav_data.ld_views[LNV_LOG]) {
bm[&logfile_sub_source::BM_FILES].prev(tc->get_top()) |
[&tc](auto vl) { tc->set_top(vl); };
[&tc](auto vl) {
// setting the selection for movement to previous file
// marker instead of the top will move the cursor, too,
// if needed.
tc->set_selection(vl);
};
} else if (tc == &lnav_data.ld_views[LNV_TEXT]) {
textfile_sub_source& tss = lnav_data.ld_text_source;

@ -596,7 +596,7 @@ com_mark(exec_context& ec, std::string cmdline, std::vector<std::string>& args)
if (args.empty() || lnav_data.ld_view_stack.empty()) {
} else if (!ec.ec_dry_run) {
auto* tc = *lnav_data.ld_view_stack.top();
lnav_data.ld_last_user_mark[tc] = tc->get_top();
lnav_data.ld_last_user_mark[tc] = tc->get_selection();
tc->toggle_user_mark(&textview_curses::BM_USER,
vis_line_t(lnav_data.ld_last_user_mark[tc]));
tc->reload_data();
@ -775,8 +775,10 @@ com_goto_mark(exec_context& ec,
}
} else {
for (const auto& bt : mark_types) {
auto bt_top = next_cluster(
&bookmark_vector<vis_line_t>::prev, bt, tc->get_top());
auto bt_top
= next_cluster(&bookmark_vector<vis_line_t>::prev,
bt,
tc->get_selection());
if (bt_top && (!new_top || bt_top > new_top.value())) {
new_top = bt_top;

Loading…
Cancel
Save