[listview] remove jump to top for down

master v0.12.2
Tim Stack 2 weeks ago
parent 545a74f35b
commit f521c7feda

@ -304,15 +304,7 @@ file_collection::watch_logfile(const std::string& filename,
return nonstd::nullopt;
}
if (loo.loo_temp_file) {
memset(&st, 0, sizeof(st));
st.st_dev = loo.loo_temp_dev;
st.st_ino = loo.loo_temp_ino;
st.st_mode = S_IFREG;
rc = 0;
} else {
rc = stat(filename.c_str(), &st);
}
rc = stat(filename.c_str(), &st);
if (rc == 0) {
if (S_ISDIR(st.st_mode) && this->fc_recursive) {
@ -405,8 +397,7 @@ file_collection::watch_logfile(const std::string& filename,
}
}
auto ff = loo.loo_temp_file ? file_format_t::UNKNOWN
: detect_file_format(filename);
auto ff = detect_file_format(filename);
loo.loo_file_format = ff;
switch (ff) {
@ -487,59 +478,54 @@ file_collection::watch_logfile(const std::string& filename,
default: {
auto filename_to_open = filename;
if (!loo.loo_temp_file) {
auto eff = detect_mime_type(filename);
auto eff = detect_mime_type(filename);
if (eff) {
auto cr = file_converter_manager::convert(
eff.value(), filename);
if (cr.isErr()) {
retval.fc_name_to_errors->writeAccess()
->emplace(filename,
file_error_info{
st.st_mtime,
cr.unwrapErr(),
});
break;
}
if (eff) {
auto cr = file_converter_manager::convert(eff.value(),
filename);
auto convert_res = cr.unwrap();
retval.fc_child_pollers.emplace_back(child_poller{
if (cr.isErr()) {
retval.fc_name_to_errors->writeAccess()->emplace(
filename,
std::move(convert_res.cr_child),
[filename,
st,
error_queue = convert_res.cr_error_queue](
auto& fc, auto& child) {
if (child.was_normal_exit()
&& child.exit_status() == EXIT_SUCCESS)
{
log_info(
"converter[%d] exited normally",
child.in());
return;
}
log_error("converter[%d] exited with %d",
child.in(),
child.status());
fc.fc_name_to_errors->writeAccess()
->emplace(
filename,
file_error_info{
st.st_mtime,
fmt::format(
FMT_STRING("{}"),
fmt::join(*error_queue,
"\n")),
});
},
});
loo.with_filename(filename);
loo.with_stat_for_temp(st);
loo.loo_format_name = eff->eff_format_name;
filename_to_open = convert_res.cr_destination;
file_error_info{
st.st_mtime,
cr.unwrapErr(),
});
break;
}
auto convert_res = cr.unwrap();
retval.fc_child_pollers.emplace_back(child_poller{
filename,
std::move(convert_res.cr_child),
[filename,
st,
error_queue = convert_res.cr_error_queue](
auto& fc, auto& child) {
if (child.was_normal_exit()
&& child.exit_status() == EXIT_SUCCESS)
{
log_info("converter[%d] exited normally",
child.in());
return;
}
log_error("converter[%d] exited with %d",
child.in(),
child.status());
fc.fc_name_to_errors->writeAccess()->emplace(
filename,
file_error_info{
st.st_mtime,
fmt::format(
FMT_STRING("{}"),
fmt::join(*error_queue, "\n")),
});
},
});
loo.with_filename(filename);
loo.with_stat_for_temp(st);
loo.loo_format_name = eff->eff_format_name;
filename_to_open = convert_res.cr_destination;
}
log_info("loading new file: filename=%s", filename.c_str());
@ -770,7 +756,7 @@ file_collection::rescan_files(bool required)
pair.second.loo_piper->get_out_pattern().string(),
pair.second,
required);
} else if (!pair.second.loo_temp_file) {
} else {
this->expand_filename(fq, pair.first, pair.second, required);
if (this->fc_rotated) {
std::string path = pair.first + ".*";

@ -790,15 +790,6 @@ listview_curses::shift_selection(shift_amount_t sa)
if (this->lv_selection <= top_for_last) {
new_selection = top_for_last + 1_vl;
}
} else {
this->shift_top(rows_avail);
auto inner_height = this->get_inner_height();
if (this->lv_selectable && this->lv_top >= top_for_last
&& inner_height > 0_vl)
{
new_selection = inner_height - 1_vl;
}
}
}
this->set_selection(new_selection);

@ -60,7 +60,6 @@ using file_location_t = mapbox::util::variant<vis_line_t, std::string>;
struct logfile_open_options_base {
std::string loo_filename;
logfile_name_source loo_source{logfile_name_source::USER};
bool loo_temp_file{false};
dev_t loo_temp_dev{0};
ino_t loo_temp_ino{0};
bool loo_detect_format{true};

@ -272,7 +272,6 @@ SELECT content_id, format, time_offset FROM lnav_file
const auto& open_opts = name_pair.second;
if (!open_opts.loo_is_visible || !open_opts.loo_include_in_session
|| open_opts.loo_temp_file
|| open_opts.loo_source != logfile_name_source::USER)
{
continue;

Loading…
Cancel
Save