mirror of
https://github.com/tstack/lnav
synced 2024-11-03 23:15:38 +00:00
[cmds] :goto was not handling timestamps with spaces
This commit is contained in:
parent
8e734eaf07
commit
9c8cc04a99
@ -396,7 +396,7 @@ com_goto(exec_context& ec, std::string cmdline, std::vector<std::string>& args)
|
||||
r, R, "to move forward/backward the same amount of time"));
|
||||
}
|
||||
} else if ((scan_end = dts.scan(
|
||||
args[1].c_str(), args[1].size(), nullptr, &tm, tv))
|
||||
all_args.c_str(), all_args.size(), nullptr, &tm, tv))
|
||||
!= nullptr)
|
||||
{
|
||||
if (ttt == nullptr) {
|
||||
@ -404,11 +404,11 @@ com_goto(exec_context& ec, std::string cmdline, std::vector<std::string>& args)
|
||||
"time values only work in a time-indexed view");
|
||||
}
|
||||
|
||||
size_t matched_size = scan_end - args[1].c_str();
|
||||
if (matched_size != args[1].size()) {
|
||||
size_t matched_size = scan_end - all_args.c_str();
|
||||
if (matched_size != all_args.size()) {
|
||||
auto um
|
||||
= lnav::console::user_message::error(
|
||||
attr_line_t("invalid timestamp: ").append(args[1]))
|
||||
attr_line_t("invalid timestamp: ").append(all_args))
|
||||
.with_reason(
|
||||
attr_line_t("the leading part of the timestamp "
|
||||
"was matched, however, the trailing "
|
||||
@ -423,12 +423,12 @@ com_goto(exec_context& ec, std::string cmdline, std::vector<std::string>& args)
|
||||
.with_help(
|
||||
"fix the timestamp or remove the trailing text");
|
||||
|
||||
auto unmatched_size = args[1].size() - matched_size;
|
||||
auto unmatched_size = all_args.size() - matched_size;
|
||||
auto& snippet_copy = um.um_snippets.back();
|
||||
attr_line_builder alb(snippet_copy.s_content);
|
||||
|
||||
alb.append("\n")
|
||||
.append(1 + cmdline.find(args[1]), ' ')
|
||||
.append(1 + cmdline.find(all_args), ' ')
|
||||
.append(matched_size, ' ');
|
||||
{
|
||||
auto attr_guard
|
||||
|
@ -130,6 +130,8 @@ EXPECTED_FILES = \
|
||||
$(srcdir)/%reldir%/test_cmds.sh_968dac54dc80d91a5da2322890c6c26dfa0d8462.out \
|
||||
$(srcdir)/%reldir%/test_cmds.sh_a00943ef715598c7554b85de8502454e41bb9e28.err \
|
||||
$(srcdir)/%reldir%/test_cmds.sh_a00943ef715598c7554b85de8502454e41bb9e28.out \
|
||||
$(srcdir)/%reldir%/test_cmds.sh_a0e6214b2a85c90d31aee12efde850441cca7eb3.err \
|
||||
$(srcdir)/%reldir%/test_cmds.sh_a0e6214b2a85c90d31aee12efde850441cca7eb3.out \
|
||||
$(srcdir)/%reldir%/test_cmds.sh_a1123427c31c022433d66d05ee5d5e1c8ab415e4.err \
|
||||
$(srcdir)/%reldir%/test_cmds.sh_a1123427c31c022433d66d05ee5d5e1c8ab415e4.out \
|
||||
$(srcdir)/%reldir%/test_cmds.sh_a190bfc279fa046a823864f1484f899d27d22953.err \
|
||||
|
@ -0,0 +1,2 @@
|
||||
[1m[4mlog_top_line() [0m
|
||||
51
|
@ -6,6 +6,11 @@ run_cap_test ${lnav_test} -n \
|
||||
-c ":switch-to-view help" \
|
||||
${test_dir}/logfile_access_log.0
|
||||
|
||||
run_cap_test ${lnav_test} -n \
|
||||
-c ":goto 2011-11-02 17:19:39" \
|
||||
-c ";SELECT log_top_line()" \
|
||||
${test_dir}/logfile_bro_http.log.0
|
||||
|
||||
run_cap_test ${lnav_test} -n \
|
||||
-c ":goto 1" \
|
||||
-c ":mark" \
|
||||
|
Loading…
Reference in New Issue
Block a user