diff --git a/kitty/data-types.h b/kitty/data-types.h index 4e0d94d60..41e8da0e1 100644 --- a/kitty/data-types.h +++ b/kitty/data-types.h @@ -250,27 +250,6 @@ typedef union LineAttrs { uint8_t val; } LineAttrs ; -typedef struct { - PyObject_HEAD - - GPUCell *gpu_cells; - CPUCell *cpu_cells; - index_type xnum, ynum; - bool needs_free; - LineAttrs attrs; -} Line; - - -typedef struct { - PyObject_HEAD - - GPUCell *gpu_cell_buf; - CPUCell *cpu_cell_buf; - index_type xnum, ynum, *line_map, *scratch; - LineAttrs *line_attrs; - Line *line; -} LineBuf; - typedef struct { GPUCell *gpu_cells; CPUCell *cpu_cells; @@ -291,16 +270,6 @@ typedef struct { hyperlink_id_type active_hyperlink_id; } ANSIBuf; -typedef struct { - PyObject_HEAD - - index_type xnum, ynum, num_segments; - HistoryBufSegment *segments; - PagerHistoryBuf *pagerhist; - Line *line; - index_type start_of_data, count; -} HistoryBuf; - typedef struct { PyObject_HEAD @@ -395,10 +364,7 @@ attrs_to_cursor(const CellAttrs attrs, Cursor *c) { // Global functions -Line* alloc_line(void); Cursor* alloc_cursor(void); -LineBuf* alloc_linebuf(unsigned int, unsigned int); -HistoryBuf* alloc_historybuf(unsigned int, unsigned int, unsigned int); ColorProfile* alloc_color_profile(void); void copy_color_profile(ColorProfile*, ColorProfile*); PyObject* parse_bytes_dump(PyObject UNUSED *, PyObject *); diff --git a/kitty/history.h b/kitty/history.h new file mode 100644 index 000000000..2dd94fa80 --- /dev/null +++ b/kitty/history.h @@ -0,0 +1,23 @@ +/* + * history.h + * Copyright (C) 2024 Kovid Goyal + * + * Distributed under terms of the GPL3 license. + */ + +#pragma once + +#include "line.h" + +typedef struct { + PyObject_HEAD + + index_type xnum, ynum, num_segments; + HistoryBufSegment *segments; + PagerHistoryBuf *pagerhist; + Line *line; + index_type start_of_data, count; +} HistoryBuf; + + +HistoryBuf* alloc_historybuf(unsigned int, unsigned int, unsigned int); diff --git a/kitty/line-buf.h b/kitty/line-buf.h new file mode 100644 index 000000000..f648f7641 --- /dev/null +++ b/kitty/line-buf.h @@ -0,0 +1,23 @@ +/* + * line-buf.h + * Copyright (C) 2024 Kovid Goyal + * + * Distributed under terms of the GPL3 license. + */ + +#pragma once + +#include "line.h" + +typedef struct { + PyObject_HEAD + + GPUCell *gpu_cell_buf; + CPUCell *cpu_cell_buf; + index_type xnum, ynum, *line_map, *scratch; + LineAttrs *line_attrs; + Line *line; +} LineBuf; + + +LineBuf* alloc_linebuf(unsigned int, unsigned int); diff --git a/kitty/line.h b/kitty/line.h new file mode 100644 index 000000000..8eb7dec9a --- /dev/null +++ b/kitty/line.h @@ -0,0 +1,22 @@ +/* + * line.h + * Copyright (C) 2024 Kovid Goyal + * + * Distributed under terms of the GPL3 license. + */ + +#pragma once + +#include "data-types.h" + +typedef struct { + PyObject_HEAD + + GPUCell *gpu_cells; + CPUCell *cpu_cells; + index_type xnum, ynum; + bool needs_free; + LineAttrs attrs; +} Line; + +Line* alloc_line(void); diff --git a/kitty/lineops.h b/kitty/lineops.h index c13b77898..f0077c7f0 100644 --- a/kitty/lineops.h +++ b/kitty/lineops.h @@ -6,7 +6,8 @@ #pragma once -#include "data-types.h" +#include "history.h" +#include "line-buf.h" #define set_attribute_on_line(cells, which, val, xnum) { \ for (index_type i__ = 0; i__ < xnum; i__++) cells[i__].attrs.which = val; } diff --git a/kitty/screen.h b/kitty/screen.h index e71c6ac6a..98a1b728f 100644 --- a/kitty/screen.h +++ b/kitty/screen.h @@ -9,6 +9,8 @@ #include "vt-parser.h" #include "graphics.h" #include "monotonic.h" +#include "line-buf.h" +#include "history.h" typedef enum ScrollTypes { SCROLL_LINE = -999999, SCROLL_PAGE, SCROLL_FULL } ScrollType;