mirror of
https://github.com/tstack/lnav.git
synced 2024-08-17 08:50:41 +03:00
[session] scroll to bottom of stdin
This commit is contained in:
parent
3ce80003bf
commit
69619892e2
@ -1000,7 +1000,7 @@ listview_curses::set_selection(vis_line_t sel)
|
||||
this->invoke_scroll();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
} else if (sel >= 0_vl) {
|
||||
this->set_top(sel);
|
||||
}
|
||||
}
|
||||
|
@ -1638,7 +1638,7 @@ looper()
|
||||
session_stage += 1;
|
||||
loop_deadline = ui_clock::now();
|
||||
log_debug("file count %d",
|
||||
lnav_data.ld_active_files.fc_files.size())
|
||||
lnav_data.ld_active_files.fc_files.size());
|
||||
}
|
||||
update_active_files(new_files);
|
||||
if (!initial_rescan_completed) {
|
||||
@ -1774,7 +1774,7 @@ looper()
|
||||
auto poll_to
|
||||
= (!changes && ui_now < loop_deadline && session_stage >= 1)
|
||||
? std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||
loop_deadline - ui_now)
|
||||
loop_deadline - ui_now)
|
||||
: 0ms;
|
||||
|
||||
if (initial_rescan_completed
|
||||
|
@ -71,7 +71,7 @@ struct logfile_open_options_base {
|
||||
file_format_t loo_file_format{file_format_t::UNKNOWN};
|
||||
nonstd::optional<std::string> loo_format_name;
|
||||
nonstd::optional<lnav::piper::running_handle> loo_piper;
|
||||
file_location_t loo_init_location;
|
||||
file_location_t loo_init_location{mapbox::util::no_init{}};
|
||||
};
|
||||
|
||||
struct logfile_open_options : public logfile_open_options_base {
|
||||
|
@ -283,6 +283,7 @@ init_session()
|
||||
{
|
||||
lnav_data.ld_session_time = time(nullptr);
|
||||
lnav_data.ld_session_id.clear();
|
||||
session_data.sd_view_states[LNV_LOG].vs_top = -1;
|
||||
}
|
||||
|
||||
static nonstd::optional<std::string>
|
||||
@ -298,6 +299,17 @@ compute_session_id()
|
||||
has_files = true;
|
||||
h.update(ld_file_name.first);
|
||||
}
|
||||
for (auto& lf : lnav_data.ld_active_files.fc_files) {
|
||||
if (lf->is_valid_filename()) {
|
||||
continue;
|
||||
}
|
||||
if (!lf->get_open_options().loo_include_in_session) {
|
||||
continue;
|
||||
}
|
||||
|
||||
has_files = true;
|
||||
h.update(lf->get_filename());
|
||||
}
|
||||
if (!has_files) {
|
||||
return nonstd::nullopt;
|
||||
}
|
||||
@ -1690,6 +1702,19 @@ lnav::session::restore_view_states()
|
||||
auto lf = lnav_data.ld_text_source.current_file();
|
||||
if (lf != nullptr) {
|
||||
has_loc = lf->get_open_options().loo_init_location.valid();
|
||||
if (!has_loc) {
|
||||
switch (lf->get_text_format()) {
|
||||
case text_format_t::TF_UNKNOWN:
|
||||
case text_format_t::TF_LOG:
|
||||
break;
|
||||
default:
|
||||
if (vs.vs_top == 0 && tview.get_top() > 0) {
|
||||
log_debug("setting to 0");
|
||||
tview.set_top(0_vl);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1701,6 +1726,7 @@ lnav::session::restore_view_states()
|
||||
lnav_view_strings[view_index],
|
||||
vs.vs_top);
|
||||
lnav_data.ld_views[view_index].set_top(vis_line_t(vs.vs_top), true);
|
||||
lnav_data.ld_views[view_index].set_selection(-1_vl);
|
||||
}
|
||||
if (!has_loc && vs.vs_selection) {
|
||||
log_info("restoring %s view selection: %d",
|
||||
|
@ -884,12 +884,12 @@ textfile_sub_source::rescan_files(
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!new_data && lf->is_indexing()
|
||||
if (lf->is_indexing()
|
||||
&& lf->get_text_format() != text_format_t::TF_BINARY)
|
||||
{
|
||||
auto ms_iter = this->tss_doc_metadata.find(lf->get_filename());
|
||||
|
||||
if (ms_iter != this->tss_doc_metadata.end()) {
|
||||
if (!new_data && ms_iter != this->tss_doc_metadata.end()) {
|
||||
if (st.st_mtime != ms_iter->second.ms_mtime
|
||||
|| st.st_size != ms_iter->second.ms_file_size)
|
||||
{
|
||||
@ -904,7 +904,7 @@ textfile_sub_source::rescan_files(
|
||||
if (read_res.isOk()) {
|
||||
auto content = attr_line_t(read_res.unwrap());
|
||||
|
||||
log_info("generating metdata for: %s",
|
||||
log_info("generating metadata for: %s",
|
||||
lf->get_filename().c_str());
|
||||
scrub_ansi_string(content.get_string(),
|
||||
&content.get_attrs());
|
||||
@ -913,6 +913,7 @@ textfile_sub_source::rescan_files(
|
||||
content.get_string(), lf->get_text_format());
|
||||
if (text_meta) {
|
||||
lf->set_filename(text_meta->tfm_filename);
|
||||
lf->set_include_in_session(true);
|
||||
callback.renamed_file(lf);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user