Skip to content

Commit

Permalink
Adding yellow highlighting of matching patterns for all C-e modes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Dvorak committed Oct 29, 2014
1 parent e0f1949 commit d28d9fb
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/hstr.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
#define HH_COLOR_INFO 2
#define HH_COLOR_PROMPT 3
#define HH_COLOR_DELETE 4
#define HH_COLOR_MATCH 5

#define HH_ENV_VAR_CONFIG "HH_CONFIG"

Expand Down Expand Up @@ -559,8 +560,8 @@ void print_selection_row(char *text, int y, int width, char *pattern)

if(pattern && strlen(pattern)) {
color_attr_on(A_BOLD);
color_attr_on(COLOR_PAIR(HH_COLOR_MATCH));
char *p;
bool keywordsAllMatch;
char *keywordsSavePtr;
char *keywordsToken;
char *keywordsParsedLine;
Expand All @@ -585,9 +586,7 @@ void print_selection_row(char *text, int y, int width, char *pattern)
mvprintw(y, 1+(p-text), "%s", pattern);
break;
case HH_MATCH_KEYWORDS:
// TODO MD split pattern using space and highlight each segment
keywordsParsedLine = strdup(pattern);
keywordsAllMatch = true;
keywordsPointerToDelete = keywordsParsedLine;
while (true) {
keywordsToken = strtok_r(keywordsParsedLine, " ", &keywordsSavePtr);
Expand All @@ -602,6 +601,7 @@ void print_selection_row(char *text, int y, int width, char *pattern)

break;
}
color_attr_on(COLOR_PAIR(HH_COLOR_NORMAL));
color_attr_off(A_BOLD);
}
}
Expand Down Expand Up @@ -771,6 +771,7 @@ void loop_to_select(Hstr *hstr)
color_init_pair(HH_COLOR_HIROW, COLOR_WHITE, COLOR_GREEN);
color_init_pair(HH_COLOR_PROMPT, COLOR_BLUE, -1);
color_init_pair(HH_COLOR_DELETE, COLOR_WHITE, COLOR_RED);
color_init_pair(HH_COLOR_MATCH, COLOR_YELLOW, -1);
}

color_attr_on(COLOR_PAIR(HH_COLOR_NORMAL));
Expand Down

0 comments on commit d28d9fb

Please sign in to comment.