From 876052ac708860585661ac8461dc792cc6f49c98 Mon Sep 17 00:00:00 2001 From: francisco souza Date: Thu, 25 Jun 2020 12:31:27 -0400 Subject: [PATCH] preview_fzf_grep: optional support for columns --- bin/preview_fzf_grep | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/preview_fzf_grep b/bin/preview_fzf_grep index e9f2af30..5d73c425 100755 --- a/bin/preview_fzf_grep +++ b/bin/preview_fzf_grep @@ -9,7 +9,7 @@ import os bat_theme = (os.environ.get('FZF_PREVIEW_PREVIEW_BAT_THEME', 'ansi-dark')) GREP_OUTPUT_REGEX = re.compile( - r'(?P.\s\s)?(?P.+):(?P\d+)(:(?P.*))?' + r'(?P.\s\s)?(?P[^:]+):(?P\d+)(:(?P\d+))?(:(?P.*))?' ) CLEAN_LINE_REGEX = re.compile(r'\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])') @@ -27,7 +27,7 @@ if not match: ) sys.exit(1) -file_name = match.group('file_name').split(':')[0] +file_name = match.group('file_name') line_num = int(match.group('line_num')) start = max(line_num - 10, 1) last = line_num + 100