<commit_before>#include <ncurses.h>
#include <stdbool.h>

static bool Running = true;
//static int Term_X = 0;
//static int Term_Y = 0;
static WINDOW* WindowLeft;
static WINDOW* WindowRight;

void handle_input(char ch) {
    if(ch == 'q')
        Running = false;
}

WINDOW* create_window(int x, int y, int height, int width) {
    WINDOW* p_win = newwin(height, width, y, x);
    box(p_win, 0, 0);
    wrefresh(p_win);
    return p_win;
}

void destroy_window(WINDOW* p_win) {
    /* Erase remnants of the window */
    wborder(p_win, ' ', ' ', ' ',' ',' ',' ',' ',' ');
    wrefresh(p_win);
    /* Delete the window */
    delwin(p_win);
}

int main(int argc, char** argv) {
    /* Initialize ncurses and user input settings */
    initscr();
    raw();
    keypad(stdscr, TRUE);
    noecho();
    refresh();
    /* Create the left and right windows */
    WindowLeft  = create_window(0,0,LINES,COLS/2);
    WindowRight = create_window(COLS/2,0,LINES,COLS/2);
    while(Running) {
        //getmaxyx(stdscr, Term_Y, Term_X);
        wprintw(WindowLeft,  "\rLeft");
        wprintw(WindowRight, "\rRight");
        wrefresh(WindowLeft);
        wrefresh(WindowRight);
        handle_input(getch());
    }<commit_msg>Resize when terminal is resized<commit_after>#include <ncurses.h>
#include <stdbool.h>
#include <signal.h>

static bool Running = true;
//static int Term_X = 0;
//static int Term_Y = 0;
static WINDOW* WindowLeft;
static WINDOW* WindowRight;

void handle_input(char ch) {
    if(ch == 'q')
        Running = false;
}

WINDOW* create_window(int x, int y, int height, int width) {
    WINDOW* p_win = newwin(height, width, y, x);
    box(p_win, 0, 0);
    wrefresh(p_win);
    return p_win;
}

void destroy_window(WINDOW* p_win) {
    /* Erase remnants of the window */
    wborder(p_win, ' ', ' ', ' ',' ',' ',' ',' ',' ');
    wrefresh(p_win);
    /* Delete the window */
    delwin(p_win);
}

void update_screen(void) {
    endwin();
    /* Create the left and right windows */
    WindowLeft  = create_window(0,0,LINES,COLS/2);
    wprintw(WindowLeft,  "\rLeft");
    wrefresh(WindowLeft);
    WindowRight = create_window(COLS/2,0,LINES,COLS/2);
    wprintw(WindowRight, "\rRight");
    wrefresh(WindowRight);
}

void handle_signal(int sig) {
    update_screen();
    signal(SIGWINCH, handle_signal);
}

int main(int argc, char** argv) {
    /* Handle terminal resizing */
    signal(SIGWINCH, handle_signal);
    /* Initialize ncurses and user input settings */
    initscr();
    raw();
    keypad(stdscr, TRUE);
    noecho();
    refresh();
    while(Running) {
        update_screen();
        handle_input(getch());
    }
{'fraction_non_alphanumeric': 0.15431164901664146, 'fraction_numerical': 0.007564296520423601, 'mean_word_length': 3.11993769470405, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '860952', 'n_tokens_mistral': 967, 'n_tokens_neox': 951, 'n_words': 222}