<commit_before>#include "fullscreen.h"

int main(void) {
  tl::Fullscreen terminal;

  absl::Mutex mu;
  bool done = false;

  auto set_done = [&]() {
    mu.Lock();
    done = true;
    mu.Unlock();
  };

  std::function<void(absl::optional<tl::Key>)> inp_cb =
      [&](absl::optional<tl::Key> c) {
        if (!c) {
          set_done();
          return;
        }
        if (c->is_character() && c->character() == 'q') {
          set_done();
          return;
        }
        terminal.NextInput(inp_cb);
      };
  std::function<void(tl::FrameBuffer*)> rdr_cb = [&](tl::FrameBuffer* fb) {
    if (!fb) {
      set_done();
      return;
    }
    const char* foo = "hello world";
    for (int i = 0; foo[i]; i++) {
      fb->cell(i, 0)->set_glyph(foo[i]);
    }
    fb->set_cursor_pos(10, 10);
    terminal.NextRender(rdr_cb);
  };

  terminal.NextInput(inp_cb);
  terminal.NextRender(rdr_cb);

  mu.LockWhen(absl::Condition(&done));
  mu.Unlock();
}
<commit_msg>ctrl+q<commit_after>#include "fullscreen.h"

int main(void) {
  tl::Fullscreen terminal;

  absl::Mutex mu;
  bool done = false;

  auto set_done = [&]() {
    mu.Lock();
    done = true;
    mu.Unlock();
  };

  std::function<void(absl::optional<tl::Key>)> inp_cb =
      [&](absl::optional<tl::Key> c) {
        if (!c) {
          set_done();
          return;
        }
        if (c->is_character() && tolower(c->character()) == 'q' &&
            c->mods() == tl::Key::CTRL) {
          set_done();
          return;
        }
        terminal.NextInput(inp_cb);
      };
  std::function<void(tl::FrameBuffer*)> rdr_cb = [&](tl::FrameBuffer* fb) {
    if (!fb) {
      set_done();
      return;
    }
    const char* foo = "hello world";
    for (int i = 0; foo[i]; i++) {
      fb->cell(i, 0)->set_glyph(foo[i]);
    }
    fb->set_cursor_pos(10, 10);
    terminal.NextRender(rdr_cb);
  };

  terminal.NextInput(inp_cb);
  terminal.NextRender(rdr_cb);

  mu.LockWhen(absl::Condition(&done));
  mu.Unlock();
}

{'fraction_non_alphanumeric': 0.19788519637462235, 'fraction_numerical': 0.006042296072507553, 'mean_word_length': 2.4377162629757785, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 22, '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': '5458654', 'n_tokens_mistral': 776, 'n_tokens_neox': 747, 'n_words': 122}