mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-09 13:45:26 +02:00
Move various data types into their own headers
This commit is contained in:
@@ -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 *);
|
||||
|
||||
23
kitty/history.h
Normal file
23
kitty/history.h
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* history.h
|
||||
* Copyright (C) 2024 Kovid Goyal <kovid at kovidgoyal.net>
|
||||
*
|
||||
* 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);
|
||||
23
kitty/line-buf.h
Normal file
23
kitty/line-buf.h
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* line-buf.h
|
||||
* Copyright (C) 2024 Kovid Goyal <kovid at kovidgoyal.net>
|
||||
*
|
||||
* 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);
|
||||
22
kitty/line.h
Normal file
22
kitty/line.h
Normal file
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* line.h
|
||||
* Copyright (C) 2024 Kovid Goyal <kovid at kovidgoyal.net>
|
||||
*
|
||||
* 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);
|
||||
@@ -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; }
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user