mirror of
https://github.com/tstack/lnav.git
synced 2024-09-11 13:05:51 +03:00
[listview] remove jump to top for down
This commit is contained in:
parent
545a74f35b
commit
f521c7feda
@ -304,15 +304,7 @@ file_collection::watch_logfile(const std::string& filename,
|
|||||||
return nonstd::nullopt;
|
return nonstd::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (loo.loo_temp_file) {
|
rc = stat(filename.c_str(), &st);
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rc == 0) {
|
if (rc == 0) {
|
||||||
if (S_ISDIR(st.st_mode) && this->fc_recursive) {
|
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
|
auto ff = detect_file_format(filename);
|
||||||
: detect_file_format(filename);
|
|
||||||
|
|
||||||
loo.loo_file_format = ff;
|
loo.loo_file_format = ff;
|
||||||
switch (ff) {
|
switch (ff) {
|
||||||
@ -487,59 +478,54 @@ file_collection::watch_logfile(const std::string& filename,
|
|||||||
default: {
|
default: {
|
||||||
auto filename_to_open = filename;
|
auto filename_to_open = filename;
|
||||||
|
|
||||||
if (!loo.loo_temp_file) {
|
auto eff = detect_mime_type(filename);
|
||||||
auto eff = detect_mime_type(filename);
|
|
||||||
|
|
||||||
if (eff) {
|
if (eff) {
|
||||||
auto cr = file_converter_manager::convert(
|
auto cr = file_converter_manager::convert(eff.value(),
|
||||||
eff.value(), filename);
|
filename);
|
||||||
|
|
||||||
if (cr.isErr()) {
|
if (cr.isErr()) {
|
||||||
retval.fc_name_to_errors->writeAccess()
|
retval.fc_name_to_errors->writeAccess()->emplace(
|
||||||
->emplace(filename,
|
|
||||||
file_error_info{
|
|
||||||
st.st_mtime,
|
|
||||||
cr.unwrapErr(),
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto convert_res = cr.unwrap();
|
|
||||||
retval.fc_child_pollers.emplace_back(child_poller{
|
|
||||||
filename,
|
filename,
|
||||||
std::move(convert_res.cr_child),
|
file_error_info{
|
||||||
[filename,
|
st.st_mtime,
|
||||||
st,
|
cr.unwrapErr(),
|
||||||
error_queue = convert_res.cr_error_queue](
|
});
|
||||||
auto& fc, auto& child) {
|
break;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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());
|
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.loo_piper->get_out_pattern().string(),
|
||||||
pair.second,
|
pair.second,
|
||||||
required);
|
required);
|
||||||
} else if (!pair.second.loo_temp_file) {
|
} else {
|
||||||
this->expand_filename(fq, pair.first, pair.second, required);
|
this->expand_filename(fq, pair.first, pair.second, required);
|
||||||
if (this->fc_rotated) {
|
if (this->fc_rotated) {
|
||||||
std::string path = pair.first + ".*";
|
std::string path = pair.first + ".*";
|
||||||
|
@ -790,15 +790,6 @@ listview_curses::shift_selection(shift_amount_t sa)
|
|||||||
if (this->lv_selection <= top_for_last) {
|
if (this->lv_selection <= top_for_last) {
|
||||||
new_selection = top_for_last + 1_vl;
|
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);
|
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 {
|
struct logfile_open_options_base {
|
||||||
std::string loo_filename;
|
std::string loo_filename;
|
||||||
logfile_name_source loo_source{logfile_name_source::USER};
|
logfile_name_source loo_source{logfile_name_source::USER};
|
||||||
bool loo_temp_file{false};
|
|
||||||
dev_t loo_temp_dev{0};
|
dev_t loo_temp_dev{0};
|
||||||
ino_t loo_temp_ino{0};
|
ino_t loo_temp_ino{0};
|
||||||
bool loo_detect_format{true};
|
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;
|
const auto& open_opts = name_pair.second;
|
||||||
|
|
||||||
if (!open_opts.loo_is_visible || !open_opts.loo_include_in_session
|
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)
|
|| open_opts.loo_source != logfile_name_source::USER)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user