bim: fix -C/-c

This commit is contained in:
K. Lange 2018-10-31 22:08:07 +09:00
parent fea6693410
commit a85611e669
2 changed files with 22 additions and 1 deletions

View File

@ -190,6 +190,8 @@ struct {
int smart_case;
int can_24bit;
int can_italic;
int go_to_line;
} global_config = {
0, /* term_width */
0, /* term_height */
@ -215,6 +217,7 @@ struct {
1, /* smart case */
1, /* can use 24-bit color */
1, /* can use italics (without inverting) */
1, /* should go to line when opening file */
};
void redraw_line(int j, int x);
@ -3111,7 +3114,9 @@ void open_file(char * file) {
recalculate_tabs(env->lines[i]);
}
goto_line(init_line);
if (global_config.go_to_line) {
goto_line(init_line);
}
fclose(f);
}
@ -6228,6 +6233,7 @@ int main(int argc, char * argv[]) {
case 'C':
/* Print file to stdout using our syntax highlighting and color theme */
initialize();
global_config.go_to_line = 0;
open_file(optarg);
for (int i = 0; i < env->line_count; ++i) {
if (opt == 'C') {

15
test.c Normal file
View File

@ -0,0 +1,15 @@
#include <stdio.h>
int main(int argc, char * argv[]) {
printf("hello, world!\n");
if (foo) {
printf("hi\n");
}
switch (thing) {
case foo:
break;
case bar:
continue;
}
return 0;
}