projects
/
selector.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added an option to put a title in the modeline.
[selector.git]
/
selector.cc
diff --git
a/selector.cc
b/selector.cc
index
0bb2d3f
..
71768e7
100644
(file)
--- a/
selector.cc
+++ b/
selector.cc
@@
-54,6
+54,7
@@
int inverse_order = 0;
int remove_duplicates = 0;
int use_regexp = 0;
int case_sensitive = 0;
int remove_duplicates = 0;
int use_regexp = 0;
int case_sensitive = 0;
+char *title = 0;
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
@@
-363,11
+364,20
@@
void update_screen(int *current_line, int *temporary_line, int motion,
// Draw the modeline
// Draw the modeline
- sprintf(buffer, "%d/%d pattern: %s%s",
- nb_printed_lines,
- nb_lines,
- pattern,
- use_regexp ? " [regexp]" : "");
+ if(title) {
+ sprintf(buffer, "%s %d/%d pattern: %s%s",
+ title,
+ nb_printed_lines,
+ nb_lines,
+ pattern,
+ use_regexp ? " [regexp]" : "");
+ } else {
+ sprintf(buffer, "%d/%d pattern: %s%s",
+ nb_printed_lines,
+ nb_lines,
+ pattern,
+ use_regexp ? " [regexp]" : "");
+ }
for(int k = strlen(buffer); k < console_width; k++) buffer[k] = ' ';
buffer[console_width] = '\0';
for(int k = strlen(buffer); k < console_width; k++) buffer[k] = ' ';
buffer[console_width] = '\0';
@@
-477,6
+487,14
@@
int main(int argc, char **argv) {
i++;
}
i++;
}
+ else if(strcmp(argv[i], "-t") == 0) {
+ check_opt(argc, argv, i, 1, "<title>");
+ delete[] title;
+ title = new char[strlen(argv[i+1]) + 1];
+ strcpy(title, argv[i+1]);
+ i += 2;
+ }
+
else if(strcmp(argv[i], "-l") == 0) {
check_opt(argc, argv, i, 1, "<maximum number of lines>");
nb_lines_max = atoi(argv[i+1]);
else if(strcmp(argv[i], "-l") == 0) {
check_opt(argc, argv, i, 1, "<maximum number of lines>");
nb_lines_max = atoi(argv[i+1]);
@@
-520,6
+538,8
@@
int main(int argc, char **argv) {
<< " -e start in regexp mode" << endl
<< " -a case sensitive" << endl
<< " -m monochrome mode" << endl
<< " -e start in regexp mode" << endl
<< " -a case sensitive" << endl
<< " -m monochrome mode" << endl
+ << " -t <title>" << endl
+ << " add a title in the modeline" << endl
<< " -c <fg modeline> <bg modeline> <fg highlight> <bg highlight>" << endl
<< " set the display colors" << endl
<< " -o <output filename>" << endl
<< " -c <fg modeline> <bg modeline> <fg highlight> <bg highlight>" << endl
<< " set the display colors" << endl
<< " -o <output filename>" << endl
@@
-769,6
+789,7
@@
int main(int argc, char **argv) {
}
delete[] lines;
}
delete[] lines;
+ delete[] title;
exit(0);
}
exit(0);
}