projects
/
selector.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
7320103
)
Cosmetics.
author
Francois Fleuret
<francois@fleuret.org>
Mon, 8 Jun 2009 07:45:43 +0000
(09:45 +0200)
committer
Francois Fleuret
<francois@fleuret.org>
Mon, 8 Jun 2009 07:45:43 +0000
(09:45 +0200)
selector.cc
patch
|
blob
|
history
diff --git
a/selector.cc
b/selector.cc
index
a22329c
..
7488bfd
100644
(file)
--- a/
selector.cc
+++ b/
selector.cc
@@
-61,10
+61,10
@@
char *title = 0;
int error_flash = 0;
#define COLOR_MODELINE 1
int error_flash = 0;
#define COLOR_MODELINE 1
-#define COLOR_
HIGHLIGHTED
_LINE 2
+#define COLOR_
FOCUS
_LINE 2
#define COLOR_ERROR 3
#define COLOR_ERROR 3
-int attr_modeline, attr_
highlighted
_line, attr_error;
+int attr_modeline, attr_
focus
_line, attr_error;
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
@@
-333,7
+333,7
@@
int next_visible(int current_line, int nb_lines, char **lines, matcher_t *matche
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
-void update_screen(int *current_line, int *temporary_line, int motion,
+void update_screen(int *current_
focus_
line, int *temporary_line, int motion,
int nb_lines, char **lines,
int cursor_position,
char *pattern) {
int nb_lines, char **lines,
int cursor_position,
char *pattern) {
@@
-358,29
+358,29
@@
void update_screen(int *current_line, int *temporary_line, int motion,
if(matcher.regexp_error) {
attron(attr_error);
if(matcher.regexp_error) {
attron(attr_error);
- addnstr("
[regexp error]
", console_width);
+ addnstr("
Regexp syntax error
", console_width);
attroff(attr_error);
} else if(nb_lines > 0) {
attroff(attr_error);
} else if(nb_lines > 0) {
- int new_line;
- if(match(lines[*current_line], &matcher)) {
- new_
line = *current
_line;
+ int new_
focus_
line;
+ if(match(lines[*current_
focus_
line], &matcher)) {
+ new_
focus_line = *current_focus
_line;
} else {
} else {
- new_
line = next_visible(*current
_line, nb_lines, lines, &matcher);
- if(new_line < 0) {
- new_
line = previous_visible(*current
_line, nb_lines, lines, &matcher);
+ new_
focus_line = next_visible(*current_focus
_line, nb_lines, lines, &matcher);
+ if(new_
focus_
line < 0) {
+ new_
focus_line = previous_visible(*current_focus
_line, nb_lines, lines, &matcher);
}
}
// If we found a visible line and we should move, let's move
}
}
// If we found a visible line and we should move, let's move
- if(new_line >= 0 && motion != 0) {
- int l = new_line;
+ if(new_
focus_
line >= 0 && motion != 0) {
+ int l = new_
focus_
line;
if(motion > 0) {
// We want to go down, let's find the first visible line below
for(int m = 0; l >= 0 && m < motion; m++) {
l = next_visible(l, nb_lines, lines, &matcher);
if(l >= 0) {
if(motion > 0) {
// We want to go down, let's find the first visible line below
for(int m = 0; l >= 0 && m < motion; m++) {
l = next_visible(l, nb_lines, lines, &matcher);
if(l >= 0) {
- new_line = l;
+ new_
focus_
line = l;
}
}
} else {
}
}
} else {
@@
-388,17
+388,17
@@
void update_screen(int *current_line, int *temporary_line, int motion,
for(int m = 0; l >= 0 && m < -motion; m++) {
l = previous_visible(l, nb_lines, lines, &matcher);
if(l >= 0) {
for(int m = 0; l >= 0 && m < -motion; m++) {
l = previous_visible(l, nb_lines, lines, &matcher);
if(l >= 0) {
- new_line = l;
+ new_
focus_
line = l;
}
}
}
}
}
}
}
}
- // Here new_line is either a line number matching the patterns, or -1
+ // Here new_
focus_
line is either a line number matching the patterns, or -1
- if(new_line >= 0) {
+ if(new_
focus_
line >= 0) {
- int first_line = new_
line, last_line = new
_line, nb_match = 1;
+ int first_line = new_
focus_line, last_line = new_focus
_line, nb_match = 1;
// We find the first and last line to show, so that the total of
// visible lines between them (them included) is console_height-1
// We find the first and last line to show, so that the total of
// visible lines between them (them included) is console_height-1
@@
-441,7
+441,7
@@
void update_screen(int *current_line, int *temporary_line, int motion,
// We fill the rest of the line with blanks if this is the
// highlighted line
// We fill the rest of the line with blanks if this is the
// highlighted line
- if(l == new_line) {
+ if(l == new_
focus_
line) {
while(k < console_width) {
buffer[k++] = ' ';
}
while(k < console_width) {
buffer[k++] = ' ';
}
@@
-454,10
+454,10
@@
void update_screen(int *current_line, int *temporary_line, int motion,
// Highlight the highlighted line ...
// Highlight the highlighted line ...
- if(l == new_line) {
- attron(attr_
highlighted
_line);
+ if(l == new_
focus_
line) {
+ attron(attr_
focus
_line);
addnstr(buffer, console_width);
addnstr(buffer, console_width);
- attroff(attr_
highlighted
_line);
+ attroff(attr_
focus
_line);
} else {
addnstr(buffer, console_width);
}
} else {
addnstr(buffer, console_width);
}
@@
-467,20
+467,20
@@
void update_screen(int *current_line, int *temporary_line, int motion,
}
if(motion != 0) {
}
if(motion != 0) {
- *current_
line = new
_line;
+ *current_
focus_line = new_focus
_line;
}
}
}
}
- *temporary_line = new_line;
+ *temporary_line = new_
focus_
line;
if(nb_printed_lines == 0) {
attron(attr_error);
if(nb_printed_lines == 0) {
attron(attr_error);
- addnstr("
[no selection]
", console_width);
+ addnstr("
No selection
", console_width);
attroff(attr_error);
}
} else {
attron(attr_error);
attroff(attr_error);
}
} else {
attron(attr_error);
- addnstr("
[empty choice]
", console_width);
+ addnstr("
Empty choice
", console_width);
attroff(attr_error);
}
attroff(attr_error);
}
@@
-885,7
+885,7
@@
int main(int argc, char **argv) {
attr_error = A_STANDOUT;
attr_modeline = A_REVERSE;
attr_error = A_STANDOUT;
attr_modeline = A_REVERSE;
- attr_
highlighted
_line = A_STANDOUT;
+ attr_
focus
_line = A_STANDOUT;
if(with_colors && has_colors()) {
if(with_colors && has_colors()) {
@@
-902,19
+902,19
@@
int main(int argc, char **argv) {
}
init_pair(COLOR_MODELINE, color_fg_modeline, color_bg_modeline);
}
init_pair(COLOR_MODELINE, color_fg_modeline, color_bg_modeline);
- init_pair(COLOR_
HIGHLIGHTED
_LINE, color_fg_highlight, color_bg_highlight);
+ init_pair(COLOR_
FOCUS
_LINE, color_fg_highlight, color_bg_highlight);
init_pair(COLOR_ERROR, COLOR_WHITE, COLOR_RED);
attr_modeline = COLOR_PAIR(COLOR_MODELINE);
init_pair(COLOR_ERROR, COLOR_WHITE, COLOR_RED);
attr_modeline = COLOR_PAIR(COLOR_MODELINE);
- attr_
highlighted_line = COLOR_PAIR(COLOR_HIGHLIGHTED
_LINE);
+ attr_
focus_line = COLOR_PAIR(COLOR_FOCUS
_LINE);
attr_error = COLOR_PAIR(COLOR_ERROR);
}
int key;
attr_error = COLOR_PAIR(COLOR_ERROR);
}
int key;
- int current_line = 0, temporary_line = 0;
+ int current_
focus_
line = 0, temporary_line = 0;
- update_screen(¤t_line, &temporary_line, 0,
+ update_screen(¤t_
focus_
line, &temporary_line, 0,
nb_lines, labels, cursor_position, pattern);
do {
nb_lines, labels, cursor_position, pattern);
do {
@@
-939,11
+939,11
@@
int main(int argc, char **argv) {
}
else if(key == KEY_HOME) {
}
else if(key == KEY_HOME) {
- current_line = 0;
+ current_
focus_
line = 0;
}
else if(key == KEY_END) {
}
else if(key == KEY_END) {
- current_line = nb_lines - 1;
+ current_
focus_
line = nb_lines - 1;
}
else if(key == KEY_NPAGE) {
}
else if(key == KEY_NPAGE) {
@@
-1005,7
+1005,7
@@
int main(int argc, char **argv) {
clear();
}
clear();
}
- update_screen(¤t_line, &temporary_line, motion,
+ update_screen(¤t_
focus_
line, &temporary_line, motion,
nb_lines, labels, cursor_position, pattern);
} while(key != '\007' && // ^G
nb_lines, labels, cursor_position, pattern);
} while(key != '\007' && // ^G