Print "^^" for a 2-wide error

This commit is contained in:
Fabian Boehm 2022-08-11 18:15:15 +02:00
parent eaf92918e6
commit c1bf06d5b1
2 changed files with 2 additions and 2 deletions

View file

@ -132,7 +132,7 @@ wcstring parse_error_t::describe_with_prefix(const wcstring &src, const wcstring
// ^~~^
// With a "^" under the start and end, and squiggles in-between.
auto width = fish_wcswidth(src.c_str() + source_start, source_length);
if (width > 2) {
if (width >= 2) {
// Subtract one for each of the carets - this is important in case
// the starting char has a width of > 1.
result.append(width - 2, L'~');

View file

@ -32,7 +32,7 @@ echo noclobber &>>?$tmpdir/file.txt
eval "echo foo |& false"
#CHECKERR: {{.*}} |& is not valid. In fish, use &| to pipe both stdout and stderr.
#CHECKERR: echo foo |& false
#CHECKERR: ^
#CHECKERR: ^^
# Ensure that redirection empty data still creates the file.
rm -f $tmpdir/file.txt