From 0a749cd6f5139fb3e4f517a9e657d4d8fd812f96 Mon Sep 17 00:00:00 2001 From: Julian Prein Date: Mon, 13 Feb 2023 17:08:16 +0100 Subject: [PATCH] git:last-changed: Equalize ANSI sanitization regex Don't know why I used two different patterns. --- .config/zsh/autoload/git/git-last-changed | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.config/zsh/autoload/git/git-last-changed b/.config/zsh/autoload/git/git-last-changed index 0fe40f5..ad988f6 100755 --- a/.config/zsh/autoload/git/git-last-changed +++ b/.config/zsh/autoload/git/git-last-changed @@ -16,7 +16,7 @@ local color_set ls -1p --color="$color_set" "$@" \ | while read -r line; do - sanitized_line="$(sed 's/\x1b[^m]*m//g' <<<"$line")" + sanitized_line="$(sed 's/\x1b\[[^m]*m//g' <<<"$line")" git_info="$(git log -1 --format=$'%ci\t%s' "$sanitized_line")" printf "%s\t%s\n" "$line" "$git_info" done \ @@ -24,7 +24,7 @@ done \ | column -s$'\t' -t \ | env COLUMNS="$COLUMNS" awk \ '{ - sanit = gensub(/\033\[[0-9;]*m/, "", "g", $0); + sanit = gensub(/\x1b\[[^m]*m/, "", "g", $0); trunc_len = ENVIRON["COLUMNS"] + length($0) - length(sanit) - 3; print gensub("^(.{" trunc_len "}).{4,}$", "\\1...", "g") }'