summaryrefslogtreecommitdiff
path: root/grep.h
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2018-05-26 13:55:22 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-05-29 05:51:28 (GMT)
commitfa151dc54dcf7ff32727d5b6fdf78093185ff1cc (patch)
tree52aac5475a1d833ff6dd09dab20f7c715aa2be93 /grep.h
parenta73b3680c4910866e3e215c3927a0c71f0b9229d (diff)
downloadgit-fa151dc54dcf7ff32727d5b6fdf78093185ff1cc.zip
git-fa151dc54dcf7ff32727d5b6fdf78093185ff1cc.tar.gz
git-fa151dc54dcf7ff32727d5b6fdf78093185ff1cc.tar.bz2
grep: keep all colors in an array
This is more inline with how we handle color slots in other code. It also allows us to get the list of configurable color slots later. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'grep.h')
-rw-r--r--grep.h21
1 files changed, 13 insertions, 8 deletions
diff --git a/grep.h b/grep.h
index 399381c..ed25be2 100644
--- a/grep.h
+++ b/grep.h
@@ -62,6 +62,18 @@ enum grep_header_field {
GREP_HEADER_FIELD_MAX
};
+enum grep_color {
+ GREP_COLOR_CONTEXT,
+ GREP_COLOR_FILENAME,
+ GREP_COLOR_FUNCTION,
+ GREP_COLOR_LINENO,
+ GREP_COLOR_MATCH_CONTEXT,
+ GREP_COLOR_MATCH_SELECTED,
+ GREP_COLOR_SELECTED,
+ GREP_COLOR_SEP,
+ NR_GREP_COLORS
+};
+
struct grep_pat {
struct grep_pat *next;
const char *origin;
@@ -155,14 +167,7 @@ struct grep_opt {
int funcbody;
int extended_regexp_option;
int pattern_type_option;
- char color_context[COLOR_MAXLEN];
- char color_filename[COLOR_MAXLEN];
- char color_function[COLOR_MAXLEN];
- char color_lineno[COLOR_MAXLEN];
- char color_match_context[COLOR_MAXLEN];
- char color_match_selected[COLOR_MAXLEN];
- char color_selected[COLOR_MAXLEN];
- char color_sep[COLOR_MAXLEN];
+ char colors[NR_GREP_COLORS][COLOR_MAXLEN];
unsigned pre_context;
unsigned post_context;
unsigned last_shown;