<commit_before>#include <errno.h>
#include <poll.h>
#include <pty.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>

#include "vterm.h"

#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>

#ifdef DEBUG
# define DEBUG_PRINT_INPUT
#endif

int master;
vterm_t *vt;

int cell_width_pango;
int cell_width;
int cell_height;

GdkRectangle invalid_area;
int cursor_visible;
GdkRectangle cursor_area;

guint cursor_timer_id;

GtkWidget *termwin;

// Actual stores of Pixmaps
GdkPixmap *termbuffer_main;
GdkPixmap *termbuffer_alternate;

// This always points at one of the above
GdkPixmap *termbuffer;
GdkGC *termbuffer_gc;

GdkGC *cursor_gc;

typedef struct {
  GdkColor fg_col;
  GdkColor bg_col;
} term_cell;

term_cell **cells;

static char *default_fg = "gray90";
static char *default_bg = "black";

static char *cursor_col = "white";
static gint cursor_blink_interval = 500;

static char *default_font = "DejaVu Sans Mono";
static int default_size = 9;

static GOptionEntry option_entries[] = {
  /* long_name, short_name, flags, arg, arg_data, description, arg_description */
  { "foreground", 0,   0, G_OPTION_ARG_STRING, &default_fg, "Default foreground colour", "COL" },
  { "background", 0,   0, G_OPTION_ARG_STRING, &default_bg, "Default background colour", "COL" },
  { "cursor",     0,   0, G_OPTION_ARG_STRING, &cursor_col, "Cursor colour", "COL" },

  { "font",       0,   0, G_OPTION_ARG_STRING, &default_font, "Font name", "FONT" },
  { "size",       's', 0, G_OPTION_ARG_INT,    &default_size, "Font size", "INT" },

  { NULL },
};

PangoFontDescription *fontdesc;

GtkIMContext *im_context;

vterm_mousefunc mousefunc;
void *mousedata;

const char *col_spec[] = {
  "black",
  "red",
  "green",
  "yellow",
  "blue",
  "magenta",
  "cyan",
  "white"
};

typedef struct {<commit_msg>pangterm.c no longer needs colour spec names<commit_after>#include <errno.h>
#include <poll.h>
#include <pty.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>

#include "vterm.h"

#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>

#ifdef DEBUG
# define DEBUG_PRINT_INPUT
#endif

int master;
vterm_t *vt;

int cell_width_pango;
int cell_width;
int cell_height;

GdkRectangle invalid_area;
int cursor_visible;
GdkRectangle cursor_area;

guint cursor_timer_id;

GtkWidget *termwin;

// Actual stores of Pixmaps
GdkPixmap *termbuffer_main;
GdkPixmap *termbuffer_alternate;

// This always points at one of the above
GdkPixmap *termbuffer;
GdkGC *termbuffer_gc;

GdkGC *cursor_gc;

typedef struct {
  GdkColor fg_col;
  GdkColor bg_col;
} term_cell;

term_cell **cells;

static char *default_fg = "gray90";
static char *default_bg = "black";

static char *cursor_col = "white";
static gint cursor_blink_interval = 500;

static char *default_font = "DejaVu Sans Mono";
static int default_size = 9;

static GOptionEntry option_entries[] = {
  /* long_name, short_name, flags, arg, arg_data, description, arg_description */
  { "foreground", 0,   0, G_OPTION_ARG_STRING, &default_fg, "Default foreground colour", "COL" },
  { "background", 0,   0, G_OPTION_ARG_STRING, &default_bg, "Default background colour", "COL" },
  { "cursor",     0,   0, G_OPTION_ARG_STRING, &cursor_col, "Cursor colour", "COL" },

  { "font",       0,   0, G_OPTION_ARG_STRING, &default_font, "Font name", "FONT" },
  { "size",       's', 0, G_OPTION_ARG_INT,    &default_size, "Font size", "INT" },

  { NULL },
};

PangoFontDescription *fontdesc;

GtkIMContext *im_context;

vterm_mousefunc mousefunc;
void *mousedata;

typedef struct {
{'fraction_non_alphanumeric': 0.13061564059900166, 'fraction_numerical': 0.008319467554076539, 'mean_word_length': 4.96198347107438, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, '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': '3974249', 'n_tokens_mistral': 1419, 'n_tokens_neox': 1374, 'n_words': 351}