From c1bf06d5b1e1e4abe767285d9601e6cc243f0f91 Mon Sep 17 00:00:00 2001 From: Fabian Boehm Date: Thu, 11 Aug 2022 18:15:15 +0200 Subject: [PATCH] Print "^^" for a 2-wide error --- src/parse_tree.cpp | 2 +- tests/checks/redirect.fish | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/parse_tree.cpp b/src/parse_tree.cpp index 5e387366b..6fc9d8404 100644 --- a/src/parse_tree.cpp +++ b/src/parse_tree.cpp @@ -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'~'); diff --git a/tests/checks/redirect.fish b/tests/checks/redirect.fish index 4043e6d91..d4d9628f5 100644 --- a/tests/checks/redirect.fish +++ b/tests/checks/redirect.fish @@ -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