fix: initialize Carla host in main.c and add terminal error checks
Co-authored-by: aider (deepseek/deepseek-coder) <aider@aider.chat>
This commit is contained in:
35
tui.c
35
tui.c
@@ -815,23 +815,34 @@ void tui_init(Engine *engine) {
|
||||
g_dispatch = engine->dispatch;
|
||||
|
||||
initscr();
|
||||
if (!has_colors()) {
|
||||
endwin();
|
||||
fprintf(stderr, "Terminal does not support colors\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
cbreak();
|
||||
noecho();
|
||||
keypad(stdscr, TRUE);
|
||||
curs_set(0);
|
||||
|
||||
// Check terminal size
|
||||
if (LINES < 20 || COLS < 40) {
|
||||
endwin();
|
||||
fprintf(stderr, "Terminal too small (need at least 20x40)\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
mousemask(BUTTON1_CLICKED | BUTTON3_CLICKED | BUTTON2_CLICKED | BUTTON1_DOUBLE_CLICKED, NULL);
|
||||
mouseinterval(10);
|
||||
|
||||
if (has_colors()) {
|
||||
start_color();
|
||||
init_pair(COLOR_EMPTY, COLOR_WHITE, COLOR_BLACK);
|
||||
init_pair(COLOR_RECORDING, COLOR_RED, COLOR_BLACK);
|
||||
init_pair(COLOR_LOOPING, COLOR_GREEN, COLOR_BLACK);
|
||||
init_pair(COLOR_STOPPED, COLOR_BLUE, COLOR_BLACK);
|
||||
init_pair(COLOR_SELECTED, COLOR_BLACK, COLOR_CYAN);
|
||||
init_pair(COLOR_HELP, COLOR_CYAN, COLOR_BLACK);
|
||||
}
|
||||
start_color();
|
||||
init_pair(COLOR_EMPTY, COLOR_WHITE, COLOR_BLACK);
|
||||
init_pair(COLOR_RECORDING, COLOR_RED, COLOR_BLACK);
|
||||
init_pair(COLOR_LOOPING, COLOR_GREEN, COLOR_BLACK);
|
||||
init_pair(COLOR_STOPPED, COLOR_BLUE, COLOR_BLACK);
|
||||
init_pair(COLOR_SELECTED, COLOR_BLACK, COLOR_CYAN);
|
||||
init_pair(COLOR_HELP, COLOR_CYAN, COLOR_BLACK);
|
||||
}
|
||||
|
||||
void tui_run(Engine *engine) {
|
||||
@@ -844,11 +855,7 @@ void tui_run(Engine *engine) {
|
||||
marks[i] = -1;
|
||||
}
|
||||
|
||||
// Initialize Carla
|
||||
AppState init_state = dispatcher_get_state();
|
||||
carla_init(&init_state.carla_host, engine->client);
|
||||
carla_scan_plugins(&init_state.carla_host);
|
||||
|
||||
// Carla is now initialized in main.c before dispatcher starts
|
||||
draw_grid();
|
||||
|
||||
while (1) {
|
||||
|
||||
Reference in New Issue
Block a user