[goto] fix error reporting issue

Fixes #1078
pull/1085/head
Tim Stack 2 years ago
parent 8acb688693
commit 554918b96c

@ -482,9 +482,10 @@ com_goto(exec_context& ec, std::string cmdline, std::vector<std::string>& args)
auto attr_guard
= alb.with_attr(VC_ROLE.value(role_t::VCR_COMMENT));
alb.append("^").append(unmatched_size - 2, '-');
alb.append("^");
if (unmatched_size > 1) {
alb.append("^");
alb.append(unmatched_size - 2, '-')
.append("^");
}
alb.append(" unrecognized input");
}

@ -36,6 +36,8 @@ EXPECTED_FILES = \
$(srcdir)/%reldir%/test_cmds.sh_1e1c8492b295913ce5afcd104cde0ec4ca1dcdac.out \
$(srcdir)/%reldir%/test_cmds.sh_1f53f5b16c7c5aa695ed2e6427d822a1b940fcf4.err \
$(srcdir)/%reldir%/test_cmds.sh_1f53f5b16c7c5aa695ed2e6427d822a1b940fcf4.out \
$(srcdir)/%reldir%/test_cmds.sh_2186d5eb6e84d6a23712334d5088c044fe089db0.err \
$(srcdir)/%reldir%/test_cmds.sh_2186d5eb6e84d6a23712334d5088c044fe089db0.out \
$(srcdir)/%reldir%/test_cmds.sh_22577861cb0921a7e7f3d1af6485938f4930ba7b.err \
$(srcdir)/%reldir%/test_cmds.sh_22577861cb0921a7e7f3d1af6485938f4930ba7b.out \
$(srcdir)/%reldir%/test_cmds.sh_2339d09953b6937981d8a448000c3fdc2837f8c4.err \

@ -0,0 +1,7 @@
✘ error: invalid timestamp: 17:00:01.
reason: the leading part of the timestamp was matched, however, the trailing text “.” was not
 --> command-option:1
 | :goto 17:00:01. 
 |  ^ unrecognized input 
 = note: input matched time format “%H:%M:%S”
 = help: fix the timestamp or remove the trailing text

@ -185,6 +185,10 @@ run_cap_test ${lnav_test} -n \
-c ':goto 2022-06-16Tabc' \
${test_dir}/logfile_access_log.0
run_cap_test ${lnav_test} -n \
-c ':goto 17:00:01.' \
${test_dir}/logfile_access_log.0
run_cap_test ${lnav_test} -n \
-c ":goto 1" \
${test_dir}/logfile_access_log.0

Loading…
Cancel
Save