projects
/
selector.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
3903830
)
Errors messages are now in red.
author
Francois Fleuret
<francois@fleuret.org>
Mon, 8 Jun 2009 07:28:32 +0000
(09:28 +0200)
committer
Francois Fleuret
<francois@fleuret.org>
Mon, 8 Jun 2009 07:28:32 +0000
(09:28 +0200)
selector.cc
patch
|
blob
|
history
diff --git
a/selector.cc
b/selector.cc
index
64f44c2
..
a62d352
100644
(file)
--- a/
selector.cc
+++ b/
selector.cc
@@
-62,6
+62,7
@@
int error_flash = 0;
#define COLOR_MODELINE 1
#define COLOR_HIGHLIGHTED_LINE 2
#define COLOR_MODELINE 1
#define COLOR_HIGHLIGHTED_LINE 2
+#define COLOR_ERROR 3
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
@@
-124,6
+125,18
@@
void error_feedback() {
}
}
}
}
+void print_error_message(const char *message, int width) {
+ if(with_colors) {
+ attron(COLOR_PAIR(COLOR_ERROR));
+ addnstr(message, width);
+ attroff(COLOR_PAIR(COLOR_ERROR));
+ } else {
+ attron(A_STANDOUT);
+ addnstr(message, width);
+ attroff(A_STANDOUT);
+ }
+}
+
//////////////////////////////////////////////////////////////////////
// A quick and dirty hash table
//////////////////////////////////////////////////////////////////////
// A quick and dirty hash table
@@
-354,7
+367,7
@@
void update_screen(int *current_line, int *temporary_line, int motion,
addstr("\n");
if(matcher.regexp_error) {
addstr("\n");
if(matcher.regexp_error) {
-
addstr("[regexp error]"
);
+
print_error_message("[regexp error]", console_width
);
} else if(nb_lines > 0) {
int new_line;
if(match(lines[*current_line], &matcher)) {
} else if(nb_lines > 0) {
int new_line;
if(match(lines[*current_line], &matcher)) {
@@
-475,10
+488,10
@@
void update_screen(int *current_line, int *temporary_line, int motion,
*temporary_line = new_line;
if(nb_printed_lines == 0) {
*temporary_line = new_line;
if(nb_printed_lines == 0) {
-
addnstr
("[no selection]\n", console_width);
+
print_error_message
("[no selection]\n", console_width);
}
} else {
}
} else {
-
addnstr
("[empty choice]\n", console_width);
+
print_error_message
("[empty choice]\n", console_width);
}
clrtobot();
}
clrtobot();
@@
-906,6
+919,7
@@
int main(int argc, char **argv) {
init_pair(COLOR_MODELINE, color_fg_modeline, color_bg_modeline);
init_pair(COLOR_HIGHLIGHTED_LINE, color_fg_highlight, color_bg_highlight);
init_pair(COLOR_MODELINE, color_fg_modeline, color_bg_modeline);
init_pair(COLOR_HIGHLIGHTED_LINE, color_fg_highlight, color_bg_highlight);
+ init_pair(COLOR_ERROR, COLOR_WHITE, COLOR_RED);
} else {
with_colors = 0;
} else {
with_colors = 0;