<commit_before>#include "Application.hpp"

#include "options/Options.hpp"

#include "curses/Display.hpp"

#include "Collection.hpp"

Application::Application(int argc, char **argv) {
    if (argc < 2) {
        std::cerr << "Nothing to pick" << std::endl;
        exit(1);
    }

    Options::parseFromCommandLine(argc, argv);
}

void Application::run() {
    Collection collection;
    bool running = true;

    auto quit = [&] {
        curses::Display::quit();
        collection.show();
        running = false;
    };

    auto select = [&] {
        collection.select();
        if (Options::single)
            quit();
    };

    while (running) {
        curses::Display::show(collection);

        switch (getch()) {
            case 'q':       quit();                         break;
            case ' ':
            case '\n':       select();                      break;
            case KEY_UP:     collection.prev();             break;
            case KEY_DOWN:   collection.next();             break;
            case KEY_RIGHT:  collection.expand();           break;
            case 'e':        collection.expandRecursive();  break;
            default:                                        break;
        }

    }
}<commit_msg>[:bug: fix] Now correctly handling terminal resize<commit_after>#include "Application.hpp"

#include "options/Options.hpp"

#include "curses/Display.hpp"

#include "Collection.hpp"

Application::Application(int argc, char **argv) {
    if (argc < 2) {
        std::cerr << "Nothing to pick" << std::endl;
        exit(1);
    }

    Options::parseFromCommandLine(argc, argv);
}

void Application::run() {
    Collection collection;
    bool running = true;

    auto quit = [&] {
        curses::Display::quit();
        collection.show();
        running = false;
    };

    auto select = [&] {
        collection.select();
        if (Options::single)
            quit();
    };

    auto resize = [] {
        curses::Display::instance().updateHeight();
    };

    while (running) {
        curses::Display::show(collection);

        switch (getch()) {
            case 'q':       quit();                         break;
            case ' ':
            case '\n':       select();                      break;
            case KEY_UP:     collection.prev();             break;
            case KEY_DOWN:   collection.next();             break;
            case KEY_RIGHT:  collection.expand();           break;
            case 'e':        collection.expandRecursive();  break;
            case KEY_RESIZE: resize();                      break;
            default:                                        break;
        }

    }
}
{'fraction_non_alphanumeric': 0.13231457323891166, 'fraction_numerical': 0.0014908684308609765, 'mean_word_length': 1.5154639175257731, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2057338', 'n_tokens_mistral': 722, 'n_tokens_neox': 697, 'n_words': 161}