fix mark files printing at panel
This commit is contained in:
parent
3ac8fad187
commit
cf5cc41034
1 changed files with 9 additions and 6 deletions
15
ccc.c
15
ccc.c
|
@ -107,7 +107,7 @@ int main(int argc, char** argv)
|
||||||
die("ccc: Terminal size needs to be at least 80x24\n");
|
die("ccc: Terminal size needs to be at least 80x24\n");
|
||||||
}
|
}
|
||||||
ch = getch();
|
ch = getch();
|
||||||
printf("%d ",ch);
|
/* printf("%d ",ch); */
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
/* quit */
|
/* quit */
|
||||||
case 'q':
|
case 'q':
|
||||||
|
@ -241,6 +241,7 @@ int main(int argc, char** argv)
|
||||||
/* mark files by space */
|
/* mark files by space */
|
||||||
case SPACE:
|
case SPACE:
|
||||||
add_file_stat(get_filepath(current_selection), 1);
|
add_file_stat(get_filepath(current_selection), 1);
|
||||||
|
highlight_current_line();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* escape */
|
/* escape */
|
||||||
|
@ -496,13 +497,15 @@ void highlight_current_line()
|
||||||
wclear(panel);
|
wclear(panel);
|
||||||
long num_marked = marked_len();
|
long num_marked = marked_len();
|
||||||
if (num_marked > 0) {
|
if (num_marked > 0) {
|
||||||
/* largest long is 2147483647, 10 characters
|
/* Determine length of formatted string */
|
||||||
* (x selected), 11 characters */
|
int m_len = snprintf(NULL, 0, "(%ld selected)", num_marked);
|
||||||
char *selected = memalloc(21 * sizeof(char));
|
char *selected = memalloc((m_len + 1) * sizeof(char));
|
||||||
snprintf(selected, 21, "(selected )", num_marked);
|
|
||||||
|
snprintf(selected, m_len + 1, "(%ld selected)", num_marked);
|
||||||
wprintw(panel, "(%ld/%ld) %s %s", current_selection + 1, files_len(), selected, cwd);
|
wprintw(panel, "(%ld/%ld) %s %s", current_selection + 1, files_len(), selected, cwd);
|
||||||
|
} else {
|
||||||
|
wprintw(panel, "(%ld/%ld) %s", current_selection + 1, files_len(), cwd);
|
||||||
}
|
}
|
||||||
wprintw(panel, "(%ld/%ld) %s", current_selection + 1, files_len(), cwd);
|
|
||||||
}
|
}
|
||||||
/* print the actual filename and stats */
|
/* print the actual filename and stats */
|
||||||
char *line = get_line(i);
|
char *line = get_line(i);
|
||||||
|
|
Loading…
Reference in a new issue