mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-13 20:18:03 +02:00
Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bd75fa6ed3 | ||
|
|
14a66762a6 | ||
|
|
507edc95a8 | ||
|
|
9fdadfabcc | ||
|
|
b58ecde740 | ||
|
|
3b71a016a6 | ||
|
|
f0c546208d | ||
|
|
e5799321f8 | ||
|
|
6133fd581a | ||
|
|
0c8231d356 | ||
|
|
788f09e855 | ||
|
|
ba7a6e8106 | ||
|
|
59ac12570c | ||
|
|
69b187a743 | ||
|
|
800291c147 | ||
|
|
1b336bf864 | ||
|
|
2630668fa5 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -7,3 +7,4 @@ build
|
||||
README.html
|
||||
linux-package
|
||||
logo/*.iconset
|
||||
test-launcher
|
||||
|
||||
48
.travis.yml
48
.travis.yml
@@ -6,7 +6,7 @@ matrix:
|
||||
group: beta
|
||||
sudo: false
|
||||
env:
|
||||
- CC=gcc ASANLIB=libasan.so.0 ASAN_ARG=--asan
|
||||
- CC=gcc SANITIZE_ARG=--sanitize
|
||||
language: python
|
||||
python: "3.5"
|
||||
addons:
|
||||
@@ -24,7 +24,25 @@ matrix:
|
||||
group: beta
|
||||
sudo: false
|
||||
env:
|
||||
- CC=clang RUN_FLAKE=1 BUILD_PKG=1
|
||||
- CC=clang SANITIZE_ARG=--sanitize
|
||||
language: python
|
||||
python: "3.5"
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- libfontconfig1-dev
|
||||
- libglew-dev
|
||||
- libxi-dev
|
||||
- libxrandr-dev
|
||||
- libxinerama-dev
|
||||
- libxcursor-dev
|
||||
|
||||
- os: linux
|
||||
dist: trusty
|
||||
group: beta
|
||||
sudo: false
|
||||
env:
|
||||
- RUN_FLAKE=1 BUILD_PKG=1
|
||||
language: python
|
||||
python: "3.5"
|
||||
addons:
|
||||
@@ -45,6 +63,13 @@ matrix:
|
||||
language: generic
|
||||
env: USE_BREW=1 BUILD_PKG=1
|
||||
|
||||
env:
|
||||
global:
|
||||
- PYTHON=python3
|
||||
- PKG_CONFIG_PATH=$HOME/glfw/lib/pkgconfig:$PKG_CONFIG_PATH
|
||||
- LD_LIBRARY_PATH=$HOME/glfw/lib:$LD_LIBRARY_PATH
|
||||
- ASAN_OPTIONS=leak_check_at_exit=0
|
||||
|
||||
install: |
|
||||
set -e
|
||||
if [[ "$RUN_FLAKE" == "1" ]]; then pip install flake8; fi
|
||||
@@ -59,7 +84,7 @@ install: |
|
||||
fi
|
||||
else
|
||||
wget -O glfw-3.2.1.zip https://github.com/glfw/glfw/archive/3.2.1.zip
|
||||
unzip glfw-3.2.1.zip
|
||||
unzip -q glfw-3.2.1.zip
|
||||
cd glfw-3.2.1
|
||||
cmake -DBUILD_SHARED_LIBS=ON -DGLFW_BUILD_EXAMPLES=OFF -DGLFW_BUILD_TESTS=OFF -DGLFW_BUILD_DOCS=OFF -DCMAKE_INSTALL_PREFIX=$HOME/glfw
|
||||
make
|
||||
@@ -67,17 +92,18 @@ install: |
|
||||
cd ..
|
||||
fi
|
||||
pkg-config --cflags glfw3
|
||||
if [[ "$TRAVIS_OS_NAME" != 'osx' ]]; then
|
||||
PLIB=$(ldd `which python` | grep libpython | cut -d ' ' -f 3)
|
||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`dirname $PLIB`
|
||||
fi
|
||||
set +e
|
||||
|
||||
env:
|
||||
global:
|
||||
- PKG_CONFIG_PATH=$HOME/glfw/lib/pkgconfig
|
||||
- LD_LIBRARY_PATH=$HOME/glfw/lib
|
||||
- ASAN_OPTIONS=leak_check_at_exit=0
|
||||
- PYTHON=python3
|
||||
before_script:
|
||||
- $PYTHON setup.py build --debug $ASAN_ARG;
|
||||
- echo $LD_LIBRARY_PATH
|
||||
- $PYTHON setup.py build --debug $SANITIZE_ARG;
|
||||
- if [[ "$TRAVIS_OS_NAME" != 'osx' ]]; then ldd ./test-launcher `which $PYTHON`; fi
|
||||
|
||||
script:
|
||||
- LD_PRELOAD=$ASANLIB $PYTHON setup.py test
|
||||
- ./test-launcher
|
||||
- if [[ "$RUN_FLAKE" == "1" ]]; then flake8 --count .; fi
|
||||
- if [[ "$BUILD_PKG" == "1" ]]; then $PYTHON setup.py linux-package; fi
|
||||
|
||||
@@ -122,7 +122,7 @@ or a similar package manager)
|
||||
|
||||
kitty is designed for power keyboard users. To that end all its controls
|
||||
work with the keyboard (although it fully supports mouse interactions as
|
||||
well). It's configuration is a simple, human editable, single file for
|
||||
well). Its configuration is a simple, human editable, single file for
|
||||
easy reproducability (I like to store config files in source control).
|
||||
|
||||
The code in kitty is designed to be simple, modular and hackable. It is
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
#!/bin/bash
|
||||
cloc --exclude-list-file <(echo -e 'kitty/wcwidth9.h\nkitty/unicode-data.h\nkitty/gl.h\nkitty/glfw.c\nkitty/glfw.h\nkitty/charsets.c\nkitty/key_encoding.py') kitty
|
||||
cloc --exclude-list-file <(echo -e 'kitty/wcwidth9.h\nkitty/unicode-data.h\nkitty/gl.h\nkitty/glfw.c\nkitty/glfw.h\nkitty/charsets.c\nkitty/key_encoding.py\nkitty/rgb.py') kitty
|
||||
|
||||
@@ -394,6 +394,12 @@ class Boss(Thread):
|
||||
def change_mouse_cursor(self, click=False):
|
||||
self.glfw_window.set_click_cursor(click)
|
||||
|
||||
def request_attention(self):
|
||||
try:
|
||||
self.glfw_window.request_window_attention()
|
||||
except AttributeError:
|
||||
pass # needs glfw 3.3
|
||||
|
||||
def start_cursor_blink(self):
|
||||
self.cursor_blinking = True
|
||||
if self.opts.cursor_stop_blinking_after > 0:
|
||||
|
||||
@@ -4,20 +4,33 @@
|
||||
|
||||
import re
|
||||
import sys
|
||||
from enum import Enum
|
||||
from collections import namedtuple
|
||||
from ctypes import addressof, memmove, sizeof
|
||||
from threading import Lock
|
||||
|
||||
from .config import build_ansi_color_table, defaults
|
||||
from .constants import get_boss, viewport_size, cell_size, ScreenGeometry, GLuint
|
||||
from .utils import get_logical_dpi, to_color, set_primary_selection, open_url, color_as_int, safe_print
|
||||
from .constants import (
|
||||
GLuint, ScreenGeometry, cell_size, get_boss, viewport_size
|
||||
)
|
||||
from .fast_data_types import (
|
||||
glUniform2ui, glUniform4f, glUniform1i, glUniform2f, glDrawArraysInstanced,
|
||||
GL_TRIANGLE_FAN, glEnable, glDisable, GL_BLEND, glDrawArrays, ColorProfile,
|
||||
CURSOR_BEAM, CURSOR_BLOCK, CURSOR_UNDERLINE, DATA_CELL_SIZE, GL_LINE_LOOP
|
||||
CURSOR_BEAM, CURSOR_BLOCK, CURSOR_UNDERLINE, DATA_CELL_SIZE, GL_BLEND,
|
||||
GL_LINE_LOOP, GL_TRIANGLE_FAN, ColorProfile, glDisable, glDrawArrays,
|
||||
glDrawArraysInstanced, glEnable, glUniform1i, glUniform2f, glUniform2ui,
|
||||
glUniform4f
|
||||
)
|
||||
from .rgb import to_color
|
||||
from .utils import (
|
||||
color_as_int, color_from_int, get_logical_dpi, open_url, safe_print,
|
||||
set_primary_selection
|
||||
)
|
||||
|
||||
Cursor = namedtuple('Cursor', 'x y shape color blink')
|
||||
Cursor = namedtuple('Cursor', 'x y shape blink')
|
||||
|
||||
|
||||
class DynamicColor(Enum):
|
||||
default_fg, default_bg, cursor_color, highlight_fg, highlight_bg = range(1, 6)
|
||||
|
||||
|
||||
if DATA_CELL_SIZE % 3:
|
||||
raise ValueError('Incorrect data cell size, must be a multiple of 3')
|
||||
@@ -245,17 +258,13 @@ class CharGrid:
|
||||
self.color_profile.update_ansi_color_table(build_ansi_color_table(opts))
|
||||
self.screen = screen
|
||||
self.opts = opts
|
||||
self.original_bg = opts.background
|
||||
self.original_fg = opts.foreground
|
||||
self.default_bg = color_as_int(self.original_bg)
|
||||
self.default_fg = color_as_int(self.original_fg)
|
||||
self.default_bg = color_as_int(opts.background)
|
||||
self.default_fg = color_as_int(opts.foreground)
|
||||
self.dpix, self.dpiy = get_logical_dpi()
|
||||
self.opts = opts
|
||||
self.default_cursor = self.current_cursor = Cursor(0, 0, opts.cursor_shape, opts.cursor, opts.cursor_blink_interval > 0)
|
||||
self.default_cursor = self.current_cursor = Cursor(0, 0, opts.cursor_shape, opts.cursor_blink_interval > 0)
|
||||
self.opts = opts
|
||||
self.original_bg = opts.background
|
||||
self.original_fg = opts.foreground
|
||||
self.selection_foreground, self.selection_background = map(color_as_int, (opts.selection_foreground, opts.selection_background))
|
||||
self.highlight_fg, self.highlight_bg = map(color_as_int, (opts.selection_foreground, opts.selection_background))
|
||||
self.sprite_map_type = self.main_sprite_map = self.scroll_sprite_map = self.render_buf = None
|
||||
|
||||
def escape(chars):
|
||||
@@ -283,16 +292,19 @@ class CharGrid:
|
||||
|
||||
def change_colors(self, changes):
|
||||
dirtied = False
|
||||
|
||||
def item(raw):
|
||||
if raw is None:
|
||||
return 0
|
||||
val = to_color(raw)
|
||||
return None if val is None else (color_as_int(val) << 8) | 1
|
||||
|
||||
for which, val in changes.items():
|
||||
if which in ('fg', 'bg'):
|
||||
if not val:
|
||||
setattr(self, 'default_' + which, color_as_int(getattr(self, 'original_' + which)))
|
||||
dirtied = True
|
||||
else:
|
||||
val = to_color(val)
|
||||
if val is not None:
|
||||
setattr(self, 'default_' + which, color_as_int(val))
|
||||
dirtied = True
|
||||
val = item(val)
|
||||
if val is None:
|
||||
continue
|
||||
dirtied = True
|
||||
setattr(self.screen, which.name, val)
|
||||
if dirtied:
|
||||
self.screen.mark_as_dirty()
|
||||
|
||||
@@ -310,12 +322,16 @@ class CharGrid:
|
||||
sprites = get_boss().sprites
|
||||
is_dirty = self.screen.is_dirty()
|
||||
with sprites.lock:
|
||||
fg = self.screen.default_fg
|
||||
fg = fg >> 8 if fg & 1 else self.default_fg
|
||||
bg = self.screen.default_bg
|
||||
bg = bg >> 8 if bg & 1 else self.default_bg
|
||||
cursor_changed, history_line_added_count = self.screen.update_cell_data(
|
||||
sprites.backend, self.color_profile, addressof(self.main_sprite_map), self.default_fg, self.default_bg, force_full_refresh)
|
||||
sprites.backend, self.color_profile, addressof(self.main_sprite_map), fg, bg, force_full_refresh)
|
||||
if self.scrolled_by:
|
||||
self.scrolled_by = min(self.scrolled_by + history_line_added_count, self.screen.historybuf.count)
|
||||
self.screen.set_scroll_cell_data(
|
||||
sprites.backend, self.color_profile, addressof(self.main_sprite_map), self.default_fg, self.default_bg,
|
||||
sprites.backend, self.color_profile, addressof(self.main_sprite_map), fg, bg,
|
||||
self.scrolled_by, addressof(self.scroll_sprite_map))
|
||||
|
||||
data = self.scroll_sprite_map if self.scrolled_by else self.main_sprite_map
|
||||
@@ -327,7 +343,7 @@ class CharGrid:
|
||||
self.render_buf_is_dirty = True
|
||||
if cursor_changed:
|
||||
c = self.screen.cursor
|
||||
self.current_cursor = Cursor(c.x, c.y, c.shape, c.color, c.blink)
|
||||
self.current_cursor = Cursor(c.x, c.y, c.shape, c.blink)
|
||||
|
||||
def cell_for_pos(self, x, y):
|
||||
x, y = int(x // cell_size.width), int(y // cell_size.height)
|
||||
@@ -458,7 +474,11 @@ class CharGrid:
|
||||
buf = self.selection_buf
|
||||
if self.render_buf_is_dirty or sel != self.last_rendered_selection:
|
||||
memmove(buf, self.render_buf, sizeof(type(buf)))
|
||||
self.screen.apply_selection(addressof(buf), start[0], start[1], end[0], end[1], self.selection_foreground, self.selection_background)
|
||||
fg = self.screen.highlight_fg
|
||||
fg = fg >> 8 if fg & 1 else self.highlight_fg
|
||||
bg = self.screen.highlight_bg
|
||||
bg = bg >> 8 if bg & 1 else self.highlight_bg
|
||||
self.screen.apply_selection(addressof(buf), start[0], start[1], end[0], end[1], fg, bg)
|
||||
if self.render_buf_is_dirty or self.last_rendered_selection != sel:
|
||||
sprites.set_sprite_map(self.buffer_id, buf)
|
||||
self.render_buf_is_dirty = False
|
||||
@@ -482,7 +502,8 @@ class CharGrid:
|
||||
ul = cursor_program.uniform_location
|
||||
left = sg.xstart + cursor.x * sg.dx
|
||||
top = sg.ystart - cursor.y * sg.dy
|
||||
col = cursor.color or self.default_cursor.color
|
||||
cc = self.screen.cursor_color
|
||||
col = color_from_int(cc >> 8) if cc & 1 else self.opts.cursor
|
||||
shape = cursor.shape or self.default_cursor.shape
|
||||
alpha = self.opts.cursor_opacity
|
||||
if alpha < 1.0 and shape == CURSOR_BLOCK:
|
||||
@@ -492,7 +513,7 @@ class CharGrid:
|
||||
bottom = top - sg.dy
|
||||
if shape == CURSOR_UNDERLINE:
|
||||
top = bottom + width(vert=False)
|
||||
glUniform4f(ul('color'), col[0], col[1], col[2], alpha)
|
||||
glUniform4f(ul('color'), col[0] / 255.0, col[1] / 255.0, col[2] / 255.0, alpha)
|
||||
glUniform2f(ul('xpos'), left, right)
|
||||
glUniform2f(ul('ypos'), top, bottom)
|
||||
glDrawArrays(GL_TRIANGLE_FAN if is_focused else GL_LINE_LOOP, 0, 4)
|
||||
|
||||
@@ -14,7 +14,8 @@ from . import fast_data_types as defines
|
||||
from .constants import config_dir
|
||||
from .fast_data_types import CURSOR_BEAM, CURSOR_BLOCK, CURSOR_UNDERLINE
|
||||
from .layout import all_layouts
|
||||
from .utils import safe_print, to_color
|
||||
from .rgb import to_color
|
||||
from .utils import safe_print
|
||||
|
||||
key_pat = re.compile(r'([a-zA-Z][a-zA-Z0-9_-]*)\s+(.+)$')
|
||||
MINIMUM_FONT_SIZE = 6
|
||||
|
||||
@@ -15,7 +15,7 @@ from .fast_data_types import (
|
||||
GLFW_KEY_LEFT_SUPER, GLFW_KEY_RIGHT_SUPER)
|
||||
|
||||
appname = 'kitty'
|
||||
version = (0, 2, 3)
|
||||
version = (0, 2, 4)
|
||||
str_version = '.'.join(map(str, version))
|
||||
_plat = sys.platform.lower()
|
||||
isosx = 'darwin' in _plat
|
||||
|
||||
@@ -24,15 +24,15 @@ dealloc(Cursor* self) {
|
||||
|
||||
#define EQ(x) (a->x == b->x)
|
||||
static int __eq__(Cursor *a, Cursor *b) {
|
||||
return EQ(bold) && EQ(italic) && EQ(strikethrough) && EQ(reverse) && EQ(decoration) && EQ(fg) && EQ(bg) && EQ(decoration_fg) && EQ(x) && EQ(y) && EQ(shape) && EQ(blink) && EQ(color);
|
||||
return EQ(bold) && EQ(italic) && EQ(strikethrough) && EQ(reverse) && EQ(decoration) && EQ(fg) && EQ(bg) && EQ(decoration_fg) && EQ(x) && EQ(y) && EQ(shape) && EQ(blink);
|
||||
}
|
||||
|
||||
#define BOOL(x) ((x) ? Py_True : Py_False)
|
||||
static PyObject *
|
||||
repr(Cursor *self) {
|
||||
return PyUnicode_FromFormat(
|
||||
"Cursor(x=%u, y=%u, shape=%d, blink=%R, color=#%08x, fg=#%08x, bg=#%08x, bold=%R, italic=%R, reverse=%R, strikethrough=%R, decoration=%d, decoration_fg=#%08x)",
|
||||
self->x, self->y, self->shape, BOOL(self->blink), self->color, self->fg, self->bg, BOOL(self->bold), BOOL(self->italic), BOOL(self->reverse), BOOL(self->strikethrough), self->decoration, self->decoration_fg
|
||||
"Cursor(x=%u, y=%u, shape=%d, blink=%R, fg=#%08x, bg=#%08x, bold=%R, italic=%R, reverse=%R, strikethrough=%R, decoration=%d, decoration_fg=#%08x)",
|
||||
self->x, self->y, self->shape, BOOL(self->blink), self->fg, self->bg, BOOL(self->bold), BOOL(self->italic), BOOL(self->reverse), BOOL(self->strikethrough), self->decoration, self->decoration_fg
|
||||
);
|
||||
}
|
||||
|
||||
@@ -52,12 +52,11 @@ void cursor_reset(Cursor *self) {
|
||||
cursor_reset_display_attrs(self);
|
||||
self->x = 0; self->y = 0;
|
||||
self->shape = 0; self->blink = false;
|
||||
self->color = 0;
|
||||
}
|
||||
|
||||
void cursor_copy_to(Cursor *src, Cursor *dest) {
|
||||
#define CCY(x) dest->x = src->x;
|
||||
CCY(x); CCY(y); CCY(shape); CCY(blink); CCY(color);
|
||||
CCY(x); CCY(y); CCY(shape); CCY(blink);
|
||||
CCY(bold); CCY(italic); CCY(strikethrough); CCY(reverse); CCY(decoration); CCY(fg); CCY(bg); CCY(decoration_fg);
|
||||
}
|
||||
|
||||
@@ -65,11 +64,6 @@ static PyObject*
|
||||
copy(Cursor *self);
|
||||
#define copy_doc "Create a clone of this cursor"
|
||||
|
||||
static PyObject* color_get(Cursor *self, void UNUSED *closure) {
|
||||
if (!(self->color & 0xFF)) { Py_RETURN_NONE; }
|
||||
return Py_BuildValue("BBB", (self->color >> 24) & 0xFF, (self->color >> 16) & 0xFF, (self->color >> 8) & 0xFF);
|
||||
}
|
||||
|
||||
// Boilerplate {{{
|
||||
|
||||
BOOL_GETSET(Cursor, bold)
|
||||
@@ -82,7 +76,6 @@ static PyMemberDef members[] = {
|
||||
{"x", T_UINT, offsetof(Cursor, x), 0, "x"},
|
||||
{"y", T_UINT, offsetof(Cursor, y), 0, "y"},
|
||||
{"shape", T_UBYTE, offsetof(Cursor, shape), 0, "shape"},
|
||||
{"color", T_ULONG, offsetof(Cursor, color), 0, "color"},
|
||||
{"decoration", T_UBYTE, offsetof(Cursor, decoration), 0, "decoration"},
|
||||
{"fg", T_ULONG, offsetof(Cursor, fg), 0, "fg"},
|
||||
{"bg", T_ULONG, offsetof(Cursor, bg), 0, "bg"},
|
||||
@@ -96,7 +89,6 @@ static PyGetSetDef getseters[] = {
|
||||
GETSET(reverse)
|
||||
GETSET(strikethrough)
|
||||
GETSET(blink)
|
||||
{"color", (getter) color_get, NULL, "color", NULL},
|
||||
{NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
|
||||
@@ -15,10 +15,11 @@
|
||||
#define UNUSED __attribute__ ((unused))
|
||||
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
|
||||
#define MIN(x, y) (((x) > (y)) ? (y) : (x))
|
||||
#define xstr(s) str(s)
|
||||
#define str(s) #s
|
||||
|
||||
typedef Py_UCS4 char_type;
|
||||
typedef uint64_t color_type;
|
||||
typedef uint32_t decoration_type;
|
||||
typedef uint32_t color_type;
|
||||
typedef uint32_t combining_type;
|
||||
typedef unsigned int index_type;
|
||||
|
||||
@@ -31,7 +32,8 @@ typedef unsigned int index_type;
|
||||
#define SGR_PROTOCOL 2
|
||||
#define URXVT_PROTOCOL 3
|
||||
|
||||
#define CELL_SIZE (sizeof(char_type) + sizeof(color_type) + sizeof(decoration_type) + sizeof(combining_type))
|
||||
#define CELL_FIELD_COUNT 5
|
||||
#define CELL_SIZE (CELL_FIELD_COUNT * 4)
|
||||
// The data cell size must be a multiple of 3
|
||||
#define DATA_CELL_SIZE 2 * 3
|
||||
|
||||
@@ -46,8 +48,6 @@ typedef unsigned int index_type;
|
||||
#define REVERSE_SHIFT 6
|
||||
#define STRIKE_SHIFT 7
|
||||
#define COL_MASK 0xFFFFFFFF
|
||||
#define COL_SHIFT 32
|
||||
#define HAS_BG_MASK (0xFF << COL_SHIFT)
|
||||
#define CC_MASK 0xFFFF
|
||||
#define CC_SHIFT 16
|
||||
#define UTF8_ACCEPT 0
|
||||
@@ -77,7 +77,8 @@ typedef unsigned int index_type;
|
||||
|
||||
#define COPY_CELL(src, s, dest, d) \
|
||||
(dest)->chars[d] = (src)->chars[s]; \
|
||||
(dest)->colors[d] = (src)->colors[s]; \
|
||||
(dest)->fg_colors[d] = (src)->fg_colors[s]; \
|
||||
(dest)->bg_colors[d] = (src)->bg_colors[s]; \
|
||||
(dest)->decoration_fg[d] = (src)->decoration_fg[s]; \
|
||||
(dest)->combining_chars[d] = (src)->combining_chars[s];
|
||||
|
||||
@@ -85,18 +86,17 @@ typedef unsigned int index_type;
|
||||
|
||||
#define COPY_LINE(src, dest) \
|
||||
memcpy((dest)->chars, (src)->chars, sizeof(char_type) * MIN((src)->xnum, (dest)->xnum)); \
|
||||
memcpy((dest)->colors, (src)->colors, sizeof(color_type) * MIN((src)->xnum, (dest)->xnum)); \
|
||||
memcpy((dest)->decoration_fg, (src)->decoration_fg, sizeof(decoration_type) * MIN((src)->xnum, (dest)->xnum)); \
|
||||
memcpy((dest)->fg_colors, (src)->fg_colors, sizeof(color_type) * MIN((src)->xnum, (dest)->xnum)); \
|
||||
memcpy((dest)->bg_colors, (src)->bg_colors, sizeof(color_type) * MIN((src)->xnum, (dest)->xnum)); \
|
||||
memcpy((dest)->decoration_fg, (src)->decoration_fg, sizeof(color_type) * MIN((src)->xnum, (dest)->xnum)); \
|
||||
memcpy((dest)->combining_chars, (src)->combining_chars, sizeof(combining_type) * MIN((src)->xnum, (dest)->xnum));
|
||||
|
||||
#define CLEAR_LINE(l, at, num) \
|
||||
for (index_type i = (at); i < (num); i++) (l)->chars[i] = (1 << ATTRS_SHIFT) | 32; \
|
||||
memset((l)->colors, (at), (num) * sizeof(color_type)); \
|
||||
memset((l)->decoration_fg, (at), (num) * sizeof(decoration_type)); \
|
||||
memset((l)->combining_chars, (at), (num) * sizeof(combining_type));
|
||||
|
||||
#define COLORS_TO_CURSOR(col, c) \
|
||||
c->fg = col & COL_MASK; c->bg = (col >> COL_SHIFT)
|
||||
#define CLEAR_LINE(l, num) \
|
||||
for (index_type i = 0; i < (num); i++) (l)->chars[i] = (1 << ATTRS_SHIFT) | 32; \
|
||||
memset((l)->fg_colors, 0, (num) * sizeof(color_type)); \
|
||||
memset((l)->bg_colors, 0, (num) * sizeof(color_type)); \
|
||||
memset((l)->decoration_fg, 0, (num) * sizeof(color_type)); \
|
||||
memset((l)->combining_chars, 0, (num) * sizeof(combining_type));
|
||||
|
||||
#define METHOD(name, arg_type) {#name, (PyCFunction)name, arg_type, name##_doc},
|
||||
|
||||
@@ -145,8 +145,9 @@ typedef struct {
|
||||
PyObject_HEAD
|
||||
|
||||
char_type *chars;
|
||||
color_type *colors;
|
||||
decoration_type *decoration_fg;
|
||||
color_type *fg_colors;
|
||||
color_type *bg_colors;
|
||||
color_type *decoration_fg;
|
||||
combining_type *combining_chars;
|
||||
index_type xnum, ynum;
|
||||
bool continued;
|
||||
@@ -166,8 +167,9 @@ typedef struct {
|
||||
|
||||
// Pointers into buf
|
||||
char_type *chars;
|
||||
color_type *colors;
|
||||
decoration_type *decoration_fg;
|
||||
color_type *fg_colors;
|
||||
color_type *bg_colors;
|
||||
color_type *decoration_fg;
|
||||
combining_type *combining_chars;
|
||||
} LineBuf;
|
||||
PyTypeObject LineBuf_Type;
|
||||
@@ -175,7 +177,7 @@ PyTypeObject LineBuf_Type;
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
|
||||
uint8_t *buf;
|
||||
uint32_t *buf;
|
||||
index_type xnum, ynum;
|
||||
Line *line;
|
||||
index_type start_of_data, count;
|
||||
@@ -188,7 +190,7 @@ typedef struct {
|
||||
bool bold, italic, reverse, strikethrough, blink;
|
||||
unsigned int x, y;
|
||||
uint8_t decoration, shape;
|
||||
unsigned long fg, bg, decoration_fg, color;
|
||||
unsigned long fg, bg, decoration_fg;
|
||||
|
||||
} Cursor;
|
||||
PyTypeObject Cursor_Type;
|
||||
@@ -289,6 +291,7 @@ typedef struct {
|
||||
unsigned int parser_state, parser_text_start, parser_buf_pos;
|
||||
bool parser_has_pending_text;
|
||||
uint8_t read_buf[READ_BUF_SZ];
|
||||
uint32_t default_fg, default_bg, highlight_fg, highlight_bg, cursor_color;
|
||||
|
||||
} Screen;
|
||||
PyTypeObject Screen_Type;
|
||||
@@ -404,7 +407,7 @@ void set_color_table_color(Screen *self, unsigned int code, PyObject*);
|
||||
uint32_t* translation_table(uint32_t which);
|
||||
uint32_t *latin1_charset;
|
||||
void screen_request_capabilities(Screen *, PyObject *);
|
||||
void report_device_attributes(Screen *self, unsigned int UNUSED mode, bool UNUSED secondary);
|
||||
void report_device_attributes(Screen *self, unsigned int UNUSED mode, char start_modifier);
|
||||
void select_graphic_rendition(Screen *self, unsigned int *params, unsigned int count);
|
||||
void report_device_status(Screen *self, unsigned int which, bool UNUSED);
|
||||
void report_mode_status(Screen *self, unsigned int which, bool);
|
||||
|
||||
@@ -140,7 +140,7 @@ static PyStructSequence_Field gm_fields[] = {
|
||||
};
|
||||
|
||||
static PyStructSequence_Desc gm_desc = {"GlpyhMetrics", NULL, gm_fields, 8};
|
||||
static PyTypeObject GlpyhMetricsType = {0};
|
||||
static PyTypeObject GlpyhMetricsType = {{{0}}};
|
||||
|
||||
static PyObject*
|
||||
glyph_metrics(Face *self) {
|
||||
@@ -167,7 +167,7 @@ static PyStructSequence_Field bm_fields[] = {
|
||||
{NULL}
|
||||
};
|
||||
static PyStructSequence_Desc bm_desc = {"Bitmap", NULL, bm_fields, 7};
|
||||
static PyTypeObject BitmapType = {0};
|
||||
static PyTypeObject BitmapType = {{{0}}};
|
||||
|
||||
static PyObject*
|
||||
bitmap(Face *self) {
|
||||
|
||||
11
kitty/glfw.c
11
kitty/glfw.c
@@ -318,6 +318,14 @@ get_window_size(Window *self) {
|
||||
return Py_BuildValue("ii", w, h);
|
||||
}
|
||||
|
||||
#ifdef glfwRequestWindowAttention
|
||||
static PyObject*
|
||||
request_window_attention(Window *self) {
|
||||
glfwRequestWindowAttention(self->window);
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// Boilerplate {{{
|
||||
#define MND(name, args) {#name, (PyCFunction)name, args, ""}
|
||||
@@ -329,6 +337,9 @@ static PyMethodDef methods[] = {
|
||||
MND(should_close, METH_NOARGS),
|
||||
MND(get_framebuffer_size, METH_NOARGS),
|
||||
MND(get_window_size, METH_NOARGS),
|
||||
#ifdef glfwRequestWindowAttention
|
||||
MND(request_window_attention, METH_NOARGS),
|
||||
#endif
|
||||
MND(set_should_close, METH_VARARGS),
|
||||
MND(set_input_mode, METH_VARARGS),
|
||||
MND(is_key_pressed, METH_VARARGS),
|
||||
|
||||
@@ -8,12 +8,13 @@
|
||||
#include "data-types.h"
|
||||
#include <structmember.h>
|
||||
|
||||
#define CELL_SIZE_H (CELL_SIZE + 1)
|
||||
#define CELL_FIELD_COUNT_H (CELL_FIELD_COUNT + 1)
|
||||
#define CELL_SIZE_H (CELL_FIELD_COUNT_H * 4)
|
||||
|
||||
static inline uint8_t*
|
||||
static inline uint32_t*
|
||||
start_of(HistoryBuf *self, index_type num) {
|
||||
// Pointer to the start of the line with index (buffer position) num
|
||||
return self->buf + CELL_SIZE_H * num * self->xnum;
|
||||
return self->buf + CELL_FIELD_COUNT_H * num * self->xnum;
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
@@ -32,7 +33,7 @@ new(PyTypeObject *type, PyObject *args, PyObject UNUSED *kwds) {
|
||||
if (self != NULL) {
|
||||
self->xnum = xnum;
|
||||
self->ynum = ynum;
|
||||
self->buf = PyMem_Calloc(xnum * ynum, CELL_SIZE_H);
|
||||
self->buf = (uint32_t*)PyMem_Calloc(xnum * ynum, CELL_SIZE_H);
|
||||
self->line = alloc_line();
|
||||
if (self->buf == NULL || self->line == NULL) {
|
||||
PyErr_NoMemory();
|
||||
@@ -41,7 +42,7 @@ new(PyTypeObject *type, PyObject *args, PyObject UNUSED *kwds) {
|
||||
} else {
|
||||
self->line->xnum = xnum;
|
||||
for(index_type y = 0; y < self->ynum; y++) {
|
||||
self->line->chars = (char_type*)(start_of(self, y) + 1);
|
||||
self->line->chars = start_of(self, y) + 1;
|
||||
for (index_type i = 0; i < self->xnum; i++) self->line->chars[i] = (1 << ATTRS_SHIFT) | 32;
|
||||
}
|
||||
}
|
||||
@@ -69,11 +70,12 @@ index_of(HistoryBuf *self, index_type lnum) {
|
||||
static inline void
|
||||
init_line(HistoryBuf *self, index_type num, Line *l) {
|
||||
// Initialize the line l, setting its pointer to the offsets for the line at index (buffer position) num
|
||||
uint8_t *start_ptr = start_of(self, num);
|
||||
l->continued = *start_ptr;
|
||||
uint32_t *start_ptr = start_of(self, num);
|
||||
l->continued = (bool)(*start_ptr);
|
||||
l->chars = (char_type*)(start_ptr + 1);
|
||||
l->colors = (color_type*)(l->chars + self->xnum);
|
||||
l->decoration_fg = (decoration_type*)(l->colors + self->xnum);
|
||||
l->fg_colors = (color_type*)(l->chars + self->xnum);
|
||||
l->bg_colors = (color_type*)(l->fg_colors + self->xnum);
|
||||
l->decoration_fg = (color_type*)(l->bg_colors + self->xnum);
|
||||
l->combining_chars = (combining_type*)(l->decoration_fg + self->xnum);
|
||||
}
|
||||
|
||||
@@ -93,16 +95,16 @@ index_type historybuf_push(HistoryBuf *self) {
|
||||
|
||||
bool
|
||||
historybuf_resize(HistoryBuf *self, index_type lines) {
|
||||
HistoryBuf t = {0};
|
||||
HistoryBuf t = {{0}};
|
||||
t.xnum=self->xnum;
|
||||
t.ynum=lines;
|
||||
if (t.ynum > 0 && t.ynum != self->ynum) {
|
||||
t.buf = PyMem_Calloc(t.xnum * t.ynum, CELL_SIZE_H);
|
||||
t.buf = (uint32_t*)PyMem_Calloc(t.xnum * t.ynum, CELL_SIZE_H);
|
||||
if (t.buf == NULL) { PyErr_NoMemory(); return false; }
|
||||
t.count = MIN(self->count, t.ynum);
|
||||
if (t.count > 0) {
|
||||
for (index_type s=0; s < t.count; s++) {
|
||||
uint8_t *src = start_of(self, index_of(self, s)), *dest = start_of(&t, index_of(&t, s));
|
||||
uint32_t *src = start_of(self, index_of(self, s)), *dest = start_of(&t, index_of(&t, s));
|
||||
memcpy(dest, src, CELL_SIZE_H * t.xnum);
|
||||
}
|
||||
}
|
||||
@@ -216,7 +218,7 @@ HistoryBuf *alloc_historybuf(unsigned int lines, unsigned int columns) {
|
||||
|
||||
#define init_src_line(src_y) init_line(src, map_src_index(src_y), src->line);
|
||||
|
||||
#define is_src_line_continued(src_y) (map_src_index(src_y) < src->ynum - 1 ? *(start_of(src, map_src_index(src_y + 1))) : false)
|
||||
#define is_src_line_continued(src_y) (map_src_index(src_y) < src->ynum - 1 ? (bool)(*(start_of(src, map_src_index(src_y + 1)))) : false)
|
||||
|
||||
#define next_dest_line(cont) *start_of(dest, historybuf_push(dest)) = cont; dest->line->continued = cont;
|
||||
|
||||
|
||||
@@ -63,8 +63,9 @@ new(PyTypeObject *type, PyObject *args, PyObject UNUSED *kwds) {
|
||||
Py_CLEAR(self);
|
||||
} else {
|
||||
self->chars = (char_type*)self->buf;
|
||||
self->colors = (color_type*)(self->chars + self->block_size);
|
||||
self->decoration_fg = (decoration_type*)(self->colors + self->block_size);
|
||||
self->fg_colors = (color_type*)(self->chars + self->block_size);
|
||||
self->bg_colors = (color_type*)(self->fg_colors + self->block_size);
|
||||
self->decoration_fg = (color_type*)(self->bg_colors + self->block_size);
|
||||
self->combining_chars = (combining_type*)(self->decoration_fg + self->block_size);
|
||||
self->line->xnum = xnum;
|
||||
for(index_type i = 0; i < ynum; i++) {
|
||||
@@ -89,7 +90,8 @@ dealloc(LineBuf* self) {
|
||||
|
||||
#define INIT_LINE(lb, l, ynum) \
|
||||
(l)->chars = (lb)->chars + (ynum) * (lb)->xnum; \
|
||||
(l)->colors = (lb)->colors + (ynum) * (lb)->xnum; \
|
||||
(l)->fg_colors = (lb)->fg_colors + (ynum) * (lb)->xnum; \
|
||||
(l)->bg_colors = (lb)->bg_colors + (ynum) * (lb)->xnum; \
|
||||
(l)->decoration_fg = (lb)->decoration_fg + (ynum) * (lb)->xnum; \
|
||||
(l)->combining_chars = (lb)->combining_chars + (ynum) * (lb)->xnum;
|
||||
|
||||
@@ -150,19 +152,22 @@ static inline int
|
||||
allocate_line_storage(Line *line, bool initialize) {
|
||||
if (initialize) {
|
||||
line->chars = PyMem_Calloc(line->xnum, sizeof(char_type));
|
||||
line->colors = PyMem_Calloc(line->xnum, sizeof(color_type));
|
||||
line->decoration_fg = PyMem_Calloc(line->xnum, sizeof(decoration_type));
|
||||
line->fg_colors = PyMem_Calloc(line->xnum, sizeof(color_type));
|
||||
line->bg_colors = PyMem_Calloc(line->xnum, sizeof(color_type));
|
||||
line->decoration_fg = PyMem_Calloc(line->xnum, sizeof(color_type));
|
||||
line->combining_chars = PyMem_Calloc(line->xnum, sizeof(combining_type));
|
||||
for (index_type i = 0; i < line->xnum; i++) line->chars[i] = (1 << ATTRS_SHIFT) | 32;
|
||||
} else {
|
||||
line->chars = PyMem_Malloc(line->xnum * sizeof(char_type));
|
||||
line->colors = PyMem_Malloc(line->xnum * sizeof(color_type));
|
||||
line->decoration_fg = PyMem_Malloc(line->xnum * sizeof(decoration_type));
|
||||
line->fg_colors = PyMem_Malloc(line->xnum * sizeof(color_type));
|
||||
line->bg_colors = PyMem_Malloc(line->xnum * sizeof(color_type));
|
||||
line->decoration_fg = PyMem_Malloc(line->xnum * sizeof(color_type));
|
||||
line->combining_chars = PyMem_Malloc(line->xnum * sizeof(combining_type));
|
||||
}
|
||||
if (line->chars == NULL || line->colors == NULL || line->decoration_fg == NULL || line->combining_chars == NULL) {
|
||||
if (line->chars == NULL || line->fg_colors == NULL || line->bg_colors == NULL || line->decoration_fg == NULL || line->combining_chars == NULL) {
|
||||
PyMem_Free(line->chars); line->chars = NULL;
|
||||
PyMem_Free(line->colors); line->colors = NULL;
|
||||
PyMem_Free(line->fg_colors); line->fg_colors = NULL;
|
||||
PyMem_Free(line->bg_colors); line->bg_colors = NULL;
|
||||
PyMem_Free(line->decoration_fg); line->decoration_fg = NULL;
|
||||
PyMem_Free(line->combining_chars); line->combining_chars = NULL;
|
||||
PyErr_NoMemory();
|
||||
@@ -210,7 +215,7 @@ copy_line_to(LineBuf *self, PyObject *args) {
|
||||
void linebuf_clear_line(LineBuf *self, index_type y) {
|
||||
Line l;
|
||||
INIT_LINE(self, &l, self->line_map[y]);
|
||||
CLEAR_LINE(&l, 0, self->xnum);
|
||||
CLEAR_LINE(&l, self->xnum);
|
||||
self->continued_map[y] = 0;
|
||||
}
|
||||
|
||||
@@ -295,7 +300,7 @@ void linebuf_insert_lines(LineBuf *self, unsigned int num, unsigned int y, unsig
|
||||
Line l;
|
||||
for (i = y; i < y + num; i++) {
|
||||
INIT_LINE(self, &l, self->line_map[i]);
|
||||
CLEAR_LINE(&l, 0, self->xnum);
|
||||
CLEAR_LINE(&l, self->xnum);
|
||||
self->continued_map[i] = 0;
|
||||
}
|
||||
}
|
||||
@@ -330,7 +335,7 @@ linebuf_delete_lines(LineBuf *self, index_type num, index_type y, index_type bot
|
||||
Line l;
|
||||
for (i = ylimit - num; i < ylimit; i++) {
|
||||
INIT_LINE(self, &l, self->line_map[i]);
|
||||
CLEAR_LINE(&l, 0, self->xnum);
|
||||
CLEAR_LINE(&l, self->xnum);
|
||||
self->continued_map[i] = 0;
|
||||
}
|
||||
}
|
||||
@@ -418,7 +423,7 @@ copy_old(LineBuf *self, PyObject *y) {
|
||||
if (!PyObject_TypeCheck(y, &LineBuf_Type)) { PyErr_SetString(PyExc_TypeError, "Not a LineBuf object"); return NULL; }
|
||||
LineBuf *other = (LineBuf*)y;
|
||||
if (other->xnum != self->xnum) { PyErr_SetString(PyExc_ValueError, "LineBuf has a different number of columns"); return NULL; }
|
||||
Line sl = {0}, ol = {0};
|
||||
Line sl = {{0}}, ol = {{0}};
|
||||
sl.xnum = self->xnum; ol.xnum = other->xnum;
|
||||
|
||||
for (index_type i = 0; i < MIN(self->ynum, other->ynum); i++) {
|
||||
|
||||
44
kitty/line.c
44
kitty/line.c
@@ -17,7 +17,8 @@ static void
|
||||
dealloc(Line* self) {
|
||||
if (self->needs_free) {
|
||||
PyMem_Free(self->chars);
|
||||
PyMem_Free(self->colors);
|
||||
PyMem_Free(self->fg_colors);
|
||||
PyMem_Free(self->bg_colors);
|
||||
PyMem_Free(self->decoration_fg);
|
||||
PyMem_Free(self->combining_chars);
|
||||
}
|
||||
@@ -170,9 +171,8 @@ line_as_ansi(Line *self, Py_UCS4 *buf, index_type buflen) {
|
||||
WRITE_SGR(0); break;
|
||||
}
|
||||
}
|
||||
color_type col = self->colors[pos];
|
||||
CHECK_COLOR(fg, col & COL_MASK, 38);
|
||||
CHECK_COLOR(bg, col >> COL_SHIFT, 48);
|
||||
CHECK_COLOR(fg, self->fg_colors[pos], 38);
|
||||
CHECK_COLOR(bg, self->bg_colors[pos], 48);
|
||||
CHECK_COLOR(decoration_fg, self->decoration_fg[pos], DECORATION_FG_CODE);
|
||||
WRITE_CH(ch);
|
||||
char_type cc = self->combining_chars[pos];
|
||||
@@ -226,15 +226,6 @@ width(Line *self, PyObject *val) {
|
||||
return PyLong_FromUnsignedLong((unsigned long) (attrs & WIDTH_MASK));
|
||||
}
|
||||
|
||||
static PyObject*
|
||||
basic_cell_data(Line *self, PyObject *val) {
|
||||
#define basic_cell_data_doc "basic_cell_data(x) -> ch, attrs, colors"
|
||||
unsigned long x = PyLong_AsUnsignedLong(val);
|
||||
if (x >= self->xnum) { PyErr_SetString(PyExc_ValueError, "Out of bounds"); return NULL; }
|
||||
char_type ch = self->chars[x];
|
||||
return Py_BuildValue("IBK", (unsigned int)(ch & CHAR_MASK), (unsigned char)(ch >> ATTRS_SHIFT), (unsigned long long)self->colors[x]);
|
||||
}
|
||||
|
||||
void line_add_combining_char(Line *self, uint32_t ch, unsigned int x) {
|
||||
combining_type c = self->combining_chars[x];
|
||||
if (c & CC_MASK) self->combining_chars[x] = (c & CC_MASK) | ( (ch & CC_MASK) << CC_SHIFT );
|
||||
@@ -279,12 +270,13 @@ set_text(Line* self, PyObject *args) {
|
||||
return NULL;
|
||||
}
|
||||
attrs = CURSOR_TO_ATTRS(cursor, 1);
|
||||
color_type col = (cursor->fg & COL_MASK) | ((color_type)(cursor->bg & COL_MASK) << COL_SHIFT);
|
||||
decoration_type dfg = cursor->decoration_fg & COL_MASK;
|
||||
color_type fg = (cursor->fg & COL_MASK), bg = cursor->bg & COL_MASK;
|
||||
color_type dfg = cursor->decoration_fg & COL_MASK;
|
||||
|
||||
for (index_type i = cursor->x; offset < limit && i < self->xnum; i++, offset++) {
|
||||
self->chars[i] = (PyUnicode_READ(kind, buf, offset) & CHAR_MASK) | attrs;
|
||||
self->colors[i] = col;
|
||||
self->fg_colors[i] = fg;
|
||||
self->bg_colors[i] = bg;
|
||||
self->decoration_fg[i] = dfg;
|
||||
self->combining_chars[i] = 0;
|
||||
}
|
||||
@@ -307,7 +299,7 @@ cursor_from(Line* self, PyObject *args) {
|
||||
ans->x = x; ans->y = y;
|
||||
char_type attrs = self->chars[x] >> ATTRS_SHIFT;
|
||||
ATTRS_TO_CURSOR(attrs, ans);
|
||||
COLORS_TO_CURSOR(self->colors[x], ans);
|
||||
ans->fg = self->fg_colors[x]; ans->bg = self->bg_colors[x];
|
||||
ans->decoration_fg = self->decoration_fg[x] & COL_MASK;
|
||||
|
||||
return (PyObject*)ans;
|
||||
@@ -335,8 +327,8 @@ clear_text(Line* self, PyObject *args) {
|
||||
void
|
||||
line_apply_cursor(Line *self, Cursor *cursor, unsigned int at, unsigned int num, bool clear_char) {
|
||||
char_type attrs = CURSOR_TO_ATTRS(cursor, 1);
|
||||
color_type col = (cursor->fg & COL_MASK) | ((color_type)(cursor->bg & COL_MASK) << COL_SHIFT);
|
||||
decoration_type dfg = cursor->decoration_fg & COL_MASK;
|
||||
color_type fg = (cursor->fg & COL_MASK), bg = (cursor->bg & COL_MASK);
|
||||
color_type dfg = cursor->decoration_fg & COL_MASK;
|
||||
if (!clear_char) attrs = ((attrs >> ATTRS_SHIFT) & ~WIDTH_MASK) << ATTRS_SHIFT;
|
||||
|
||||
for (index_type i = at; i < self->xnum && i < at + num; i++) {
|
||||
@@ -347,7 +339,7 @@ line_apply_cursor(Line *self, Cursor *cursor, unsigned int at, unsigned int num,
|
||||
char_type w = ((self->chars[i] >> ATTRS_SHIFT) & WIDTH_MASK) << ATTRS_SHIFT;
|
||||
self->chars[i] = (self->chars[i] & CHAR_MASK) | attrs | w;
|
||||
}
|
||||
self->colors[i] = col;
|
||||
self->fg_colors[i] = fg; self->bg_colors[i] = bg;
|
||||
self->decoration_fg[i] = dfg;
|
||||
}
|
||||
}
|
||||
@@ -407,7 +399,8 @@ line_set_char(Line *self, unsigned int at, uint32_t ch, unsigned int width, Curs
|
||||
attrs = (((self->chars[at] >> ATTRS_SHIFT) & ~3) | (width & 3)) << ATTRS_SHIFT;
|
||||
} else {
|
||||
attrs = CURSOR_TO_ATTRS(cursor, width & 3);
|
||||
self->colors[at] = (cursor->fg & COL_MASK) | ((color_type)(cursor->bg & COL_MASK) << COL_SHIFT);
|
||||
self->fg_colors[at] = (cursor->fg & COL_MASK);
|
||||
self->bg_colors[at] = (cursor->bg & COL_MASK);
|
||||
self->decoration_fg[at] = cursor->decoration_fg & COL_MASK;
|
||||
}
|
||||
self->chars[at] = (ch & CHAR_MASK) | attrs;
|
||||
@@ -449,8 +442,9 @@ __len__(PyObject *self) {
|
||||
static int __eq__(Line *a, Line *b) {
|
||||
return a->xnum == b->xnum && \
|
||||
memcmp(a->chars, b->chars, sizeof(char_type) * a->xnum) == 0 && \
|
||||
memcmp(a->colors, b->colors, sizeof(color_type) * a->xnum) == 0 && \
|
||||
memcmp(a->decoration_fg, b->decoration_fg, sizeof(decoration_type) * a->xnum) == 0 && \
|
||||
memcmp(a->fg_colors, b->fg_colors, sizeof(color_type) * a->xnum) == 0 && \
|
||||
memcmp(a->bg_colors, b->bg_colors, sizeof(color_type) * a->xnum) == 0 && \
|
||||
memcmp(a->decoration_fg, b->decoration_fg, sizeof(color_type) * a->xnum) == 0 && \
|
||||
memcmp(a->combining_chars, b->combining_chars, sizeof(combining_type) * a->xnum) == 0;
|
||||
}
|
||||
|
||||
@@ -483,7 +477,6 @@ static PyMethodDef methods[] = {
|
||||
METHOD(as_ansi, METH_NOARGS)
|
||||
METHOD(is_continued, METH_NOARGS)
|
||||
METHOD(width, METH_O)
|
||||
METHOD(basic_cell_data, METH_O)
|
||||
|
||||
{NULL} /* Sentinel */
|
||||
};
|
||||
@@ -522,7 +515,8 @@ copy_char(Line* self, PyObject *args) {
|
||||
return NULL;
|
||||
}
|
||||
to->chars[dest] = self->chars[src];
|
||||
to->colors[dest] = self->colors[src];
|
||||
to->fg_colors[dest] = self->fg_colors[src];
|
||||
to->bg_colors[dest] = self->bg_colors[src];
|
||||
to->decoration_fg[dest] = self->decoration_fg[src];
|
||||
to->combining_chars[dest] = self->combining_chars[src];
|
||||
Py_RETURN_NONE;
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
# License: GPL v3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
|
||||
|
||||
import argparse
|
||||
import locale
|
||||
import os
|
||||
import sys
|
||||
import tempfile
|
||||
@@ -30,6 +31,7 @@ from .layout import all_layouts
|
||||
from .shaders import GL_VERSION
|
||||
from .utils import safe_print
|
||||
|
||||
|
||||
defconf = os.path.join(config_dir, 'kitty.conf')
|
||||
|
||||
|
||||
@@ -223,6 +225,7 @@ def on_glfw_error(code, msg):
|
||||
|
||||
|
||||
def main():
|
||||
locale.setlocale(locale.LC_ALL, '')
|
||||
if os.environ.pop('KITTY_LAUNCHED_BY_LAUNCH_SERVICES',
|
||||
None) == '1' and getattr(sys, 'frozen', True):
|
||||
os.chdir(os.path.expanduser('~'))
|
||||
|
||||
@@ -295,8 +295,14 @@ dispatch_osc(Screen *screen, PyObject DUMP_UNUSED *dump_callback) {
|
||||
break;
|
||||
case 10:
|
||||
case 11:
|
||||
case 12:
|
||||
case 17:
|
||||
case 19:
|
||||
case 110:
|
||||
case 111:
|
||||
case 112:
|
||||
case 117:
|
||||
case 119:
|
||||
SET_COLOR(set_dynamic_color);
|
||||
break;
|
||||
default:
|
||||
@@ -356,6 +362,12 @@ dispatch_csi(Screen *screen, PyObject DUMP_UNUSED *dump_callback) {
|
||||
name(screen, p1, private); \
|
||||
break;
|
||||
|
||||
#define CALL_CSI_HANDLER1S(name, defval) \
|
||||
p1 = num_params > 0 ? params[0] : defval; \
|
||||
REPORT_COMMAND(name, p1, start_modifier); \
|
||||
name(screen, p1, start_modifier); \
|
||||
break;
|
||||
|
||||
#define CALL_CSI_HANDLER1M(name, defval) \
|
||||
p1 = num_params > 0 ? params[0] : defval; \
|
||||
REPORT_COMMAND(name, p1, end_modifier); \
|
||||
@@ -452,7 +464,7 @@ dispatch_csi(Screen *screen, PyObject DUMP_UNUSED *dump_callback) {
|
||||
case ECH:
|
||||
CALL_CSI_HANDLER1(screen_erase_characters, 1);
|
||||
case DA:
|
||||
CALL_CSI_HANDLER1P(report_device_attributes, 0, '>');
|
||||
CALL_CSI_HANDLER1S(report_device_attributes, 0);
|
||||
case TBC:
|
||||
CALL_CSI_HANDLER1(screen_clear_tab_stop, 0);
|
||||
case SM:
|
||||
|
||||
@@ -43,8 +43,9 @@
|
||||
|
||||
static inline void copy_range(Line *src, index_type src_at, Line* dest, index_type dest_at, index_type num) {
|
||||
memcpy(dest->chars + dest_at, src->chars + src_at, num * sizeof(char_type));
|
||||
memcpy(dest->colors + dest_at, src->colors + src_at, num * sizeof(color_type));
|
||||
memcpy(dest->decoration_fg + dest_at, src->decoration_fg + src_at, num * sizeof(decoration_type));
|
||||
memcpy(dest->fg_colors + dest_at, src->fg_colors + src_at, num * sizeof(color_type));
|
||||
memcpy(dest->bg_colors + dest_at, src->bg_colors + src_at, num * sizeof(color_type));
|
||||
memcpy(dest->decoration_fg + dest_at, src->decoration_fg + src_at, num * sizeof(color_type));
|
||||
memcpy(dest->combining_chars + dest_at, src->combining_chars + src_at, num * sizeof(combining_type));
|
||||
}
|
||||
|
||||
|
||||
816
kitty/rgb.py
Normal file
816
kitty/rgb.py
Normal file
@@ -0,0 +1,816 @@
|
||||
#!/usr/bin/env python
|
||||
# vim:fileencoding=utf-8
|
||||
# License: GPL v3 Copyright: 2017, Kovid Goyal <kovid at kovidgoyal.net>
|
||||
|
||||
import re
|
||||
from collections import namedtuple
|
||||
|
||||
Color = namedtuple('Color', 'red green blue')
|
||||
|
||||
color_pat = re.compile(r'^#([a-fA-F0-9]{3}|[a-fA-F0-9]{6})$')
|
||||
color_pat2 = re.compile(
|
||||
r'rgb:([a-f0-9]{2})/([a-f0-9]{2})/([a-f0-9]{2})$', re.IGNORECASE
|
||||
)
|
||||
|
||||
|
||||
def to_color(raw, validate=False):
|
||||
x = raw.strip().lower()
|
||||
ans = color_names.get(x)
|
||||
if ans is not None:
|
||||
return ans
|
||||
m = color_pat.match(x)
|
||||
val = None
|
||||
if m is not None:
|
||||
val = m.group(1)
|
||||
if len(val) == 3:
|
||||
val = ''.join(2 * s for s in val)
|
||||
else:
|
||||
m = color_pat2.match(x)
|
||||
if m is not None:
|
||||
val = m.group(1) + m.group(2) + m.group(3)
|
||||
if val is None:
|
||||
if validate:
|
||||
raise ValueError('Invalid color name: {}'.format(raw))
|
||||
return
|
||||
return Color(int(val[:2], 16), int(val[2:4], 16), int(val[4:], 16))
|
||||
|
||||
|
||||
# BEGIN_DATA_SECTION {{{
|
||||
color_names = {
|
||||
'alice blue': Color(240, 248, 255),
|
||||
'aliceblue': Color(240, 248, 255),
|
||||
'antique white': Color(250, 235, 215),
|
||||
'antiquewhite': Color(250, 235, 215),
|
||||
'antiquewhite1': Color(255, 239, 219),
|
||||
'antiquewhite2': Color(238, 223, 204),
|
||||
'antiquewhite3': Color(205, 192, 176),
|
||||
'antiquewhite4': Color(139, 131, 120),
|
||||
'aquamarine': Color(127, 255, 212),
|
||||
'aquamarine1': Color(127, 255, 212),
|
||||
'aquamarine2': Color(118, 238, 198),
|
||||
'aquamarine3': Color(102, 205, 170),
|
||||
'aquamarine4': Color(69, 139, 116),
|
||||
'azure': Color(240, 255, 255),
|
||||
'azure1': Color(240, 255, 255),
|
||||
'azure2': Color(224, 238, 238),
|
||||
'azure3': Color(193, 205, 205),
|
||||
'azure4': Color(131, 139, 139),
|
||||
'beige': Color(245, 245, 220),
|
||||
'bisque': Color(255, 228, 196),
|
||||
'bisque1': Color(255, 228, 196),
|
||||
'bisque2': Color(238, 213, 183),
|
||||
'bisque3': Color(205, 183, 158),
|
||||
'bisque4': Color(139, 125, 107),
|
||||
'black': Color(0, 0, 0),
|
||||
'blanched almond': Color(255, 235, 205),
|
||||
'blanchedalmond': Color(255, 235, 205),
|
||||
'blue': Color(0, 0, 255),
|
||||
'blue violet': Color(138, 43, 226),
|
||||
'blue1': Color(0, 0, 255),
|
||||
'blue2': Color(0, 0, 238),
|
||||
'blue3': Color(0, 0, 205),
|
||||
'blue4': Color(0, 0, 139),
|
||||
'blueviolet': Color(138, 43, 226),
|
||||
'brown': Color(165, 42, 42),
|
||||
'brown1': Color(255, 64, 64),
|
||||
'brown2': Color(238, 59, 59),
|
||||
'brown3': Color(205, 51, 51),
|
||||
'brown4': Color(139, 35, 35),
|
||||
'burlywood': Color(222, 184, 135),
|
||||
'burlywood1': Color(255, 211, 155),
|
||||
'burlywood2': Color(238, 197, 145),
|
||||
'burlywood3': Color(205, 170, 125),
|
||||
'burlywood4': Color(139, 115, 85),
|
||||
'cadet blue': Color(95, 158, 160),
|
||||
'cadetblue': Color(95, 158, 160),
|
||||
'cadetblue1': Color(152, 245, 255),
|
||||
'cadetblue2': Color(142, 229, 238),
|
||||
'cadetblue3': Color(122, 197, 205),
|
||||
'cadetblue4': Color(83, 134, 139),
|
||||
'chartreuse': Color(127, 255, 0),
|
||||
'chartreuse1': Color(127, 255, 0),
|
||||
'chartreuse2': Color(118, 238, 0),
|
||||
'chartreuse3': Color(102, 205, 0),
|
||||
'chartreuse4': Color(69, 139, 0),
|
||||
'chocolate': Color(210, 105, 30),
|
||||
'chocolate1': Color(255, 127, 36),
|
||||
'chocolate2': Color(238, 118, 33),
|
||||
'chocolate3': Color(205, 102, 29),
|
||||
'chocolate4': Color(139, 69, 19),
|
||||
'coral': Color(255, 127, 80),
|
||||
'coral1': Color(255, 114, 86),
|
||||
'coral2': Color(238, 106, 80),
|
||||
'coral3': Color(205, 91, 69),
|
||||
'coral4': Color(139, 62, 47),
|
||||
'cornflower blue': Color(100, 149, 237),
|
||||
'cornflowerblue': Color(100, 149, 237),
|
||||
'cornsilk': Color(255, 248, 220),
|
||||
'cornsilk1': Color(255, 248, 220),
|
||||
'cornsilk2': Color(238, 232, 205),
|
||||
'cornsilk3': Color(205, 200, 177),
|
||||
'cornsilk4': Color(139, 136, 120),
|
||||
'cyan': Color(0, 255, 255),
|
||||
'cyan1': Color(0, 255, 255),
|
||||
'cyan2': Color(0, 238, 238),
|
||||
'cyan3': Color(0, 205, 205),
|
||||
'cyan4': Color(0, 139, 139),
|
||||
'dark blue': Color(0, 0, 139),
|
||||
'dark cyan': Color(0, 139, 139),
|
||||
'dark goldenrod': Color(184, 134, 11),
|
||||
'dark gray': Color(169, 169, 169),
|
||||
'dark green': Color(0, 100, 0),
|
||||
'dark grey': Color(169, 169, 169),
|
||||
'dark khaki': Color(189, 183, 107),
|
||||
'dark magenta': Color(139, 0, 139),
|
||||
'dark olive green': Color(85, 107, 47),
|
||||
'dark orange': Color(255, 140, 0),
|
||||
'dark orchid': Color(153, 50, 204),
|
||||
'dark red': Color(139, 0, 0),
|
||||
'dark salmon': Color(233, 150, 122),
|
||||
'dark sea green': Color(143, 188, 143),
|
||||
'dark slate blue': Color(72, 61, 139),
|
||||
'dark slate gray': Color(47, 79, 79),
|
||||
'dark slate grey': Color(47, 79, 79),
|
||||
'dark turquoise': Color(0, 206, 209),
|
||||
'dark violet': Color(148, 0, 211),
|
||||
'darkblue': Color(0, 0, 139),
|
||||
'darkcyan': Color(0, 139, 139),
|
||||
'darkgoldenrod': Color(184, 134, 11),
|
||||
'darkgoldenrod1': Color(255, 185, 15),
|
||||
'darkgoldenrod2': Color(238, 173, 14),
|
||||
'darkgoldenrod3': Color(205, 149, 12),
|
||||
'darkgoldenrod4': Color(139, 101, 8),
|
||||
'darkgray': Color(169, 169, 169),
|
||||
'darkgreen': Color(0, 100, 0),
|
||||
'darkgrey': Color(169, 169, 169),
|
||||
'darkkhaki': Color(189, 183, 107),
|
||||
'darkmagenta': Color(139, 0, 139),
|
||||
'darkolivegreen': Color(85, 107, 47),
|
||||
'darkolivegreen1': Color(202, 255, 112),
|
||||
'darkolivegreen2': Color(188, 238, 104),
|
||||
'darkolivegreen3': Color(162, 205, 90),
|
||||
'darkolivegreen4': Color(110, 139, 61),
|
||||
'darkorange': Color(255, 140, 0),
|
||||
'darkorange1': Color(255, 127, 0),
|
||||
'darkorange2': Color(238, 118, 0),
|
||||
'darkorange3': Color(205, 102, 0),
|
||||
'darkorange4': Color(139, 69, 0),
|
||||
'darkorchid': Color(153, 50, 204),
|
||||
'darkorchid1': Color(191, 62, 255),
|
||||
'darkorchid2': Color(178, 58, 238),
|
||||
'darkorchid3': Color(154, 50, 205),
|
||||
'darkorchid4': Color(104, 34, 139),
|
||||
'darkred': Color(139, 0, 0),
|
||||
'darksalmon': Color(233, 150, 122),
|
||||
'darkseagreen': Color(143, 188, 143),
|
||||
'darkseagreen1': Color(193, 255, 193),
|
||||
'darkseagreen2': Color(180, 238, 180),
|
||||
'darkseagreen3': Color(155, 205, 155),
|
||||
'darkseagreen4': Color(105, 139, 105),
|
||||
'darkslateblue': Color(72, 61, 139),
|
||||
'darkslategray': Color(47, 79, 79),
|
||||
'darkslategray1': Color(151, 255, 255),
|
||||
'darkslategray2': Color(141, 238, 238),
|
||||
'darkslategray3': Color(121, 205, 205),
|
||||
'darkslategray4': Color(82, 139, 139),
|
||||
'darkslategrey': Color(47, 79, 79),
|
||||
'darkturquoise': Color(0, 206, 209),
|
||||
'darkviolet': Color(148, 0, 211),
|
||||
'debianred': Color(215, 7, 81),
|
||||
'deep pink': Color(255, 20, 147),
|
||||
'deep sky blue': Color(0, 191, 255),
|
||||
'deeppink': Color(255, 20, 147),
|
||||
'deeppink1': Color(255, 20, 147),
|
||||
'deeppink2': Color(238, 18, 137),
|
||||
'deeppink3': Color(205, 16, 118),
|
||||
'deeppink4': Color(139, 10, 80),
|
||||
'deepskyblue': Color(0, 191, 255),
|
||||
'deepskyblue1': Color(0, 191, 255),
|
||||
'deepskyblue2': Color(0, 178, 238),
|
||||
'deepskyblue3': Color(0, 154, 205),
|
||||
'deepskyblue4': Color(0, 104, 139),
|
||||
'dim gray': Color(105, 105, 105),
|
||||
'dim grey': Color(105, 105, 105),
|
||||
'dimgray': Color(105, 105, 105),
|
||||
'dimgrey': Color(105, 105, 105),
|
||||
'dodger blue': Color(30, 144, 255),
|
||||
'dodgerblue': Color(30, 144, 255),
|
||||
'dodgerblue1': Color(30, 144, 255),
|
||||
'dodgerblue2': Color(28, 134, 238),
|
||||
'dodgerblue3': Color(24, 116, 205),
|
||||
'dodgerblue4': Color(16, 78, 139),
|
||||
'firebrick': Color(178, 34, 34),
|
||||
'firebrick1': Color(255, 48, 48),
|
||||
'firebrick2': Color(238, 44, 44),
|
||||
'firebrick3': Color(205, 38, 38),
|
||||
'firebrick4': Color(139, 26, 26),
|
||||
'floral white': Color(255, 250, 240),
|
||||
'floralwhite': Color(255, 250, 240),
|
||||
'forest green': Color(34, 139, 34),
|
||||
'forestgreen': Color(34, 139, 34),
|
||||
'gainsboro': Color(220, 220, 220),
|
||||
'ghost white': Color(248, 248, 255),
|
||||
'ghostwhite': Color(248, 248, 255),
|
||||
'gold': Color(255, 215, 0),
|
||||
'gold1': Color(255, 215, 0),
|
||||
'gold2': Color(238, 201, 0),
|
||||
'gold3': Color(205, 173, 0),
|
||||
'gold4': Color(139, 117, 0),
|
||||
'goldenrod': Color(218, 165, 32),
|
||||
'goldenrod1': Color(255, 193, 37),
|
||||
'goldenrod2': Color(238, 180, 34),
|
||||
'goldenrod3': Color(205, 155, 29),
|
||||
'goldenrod4': Color(139, 105, 20),
|
||||
'gray': Color(190, 190, 190),
|
||||
'gray0': Color(0, 0, 0),
|
||||
'gray1': Color(3, 3, 3),
|
||||
'gray10': Color(26, 26, 26),
|
||||
'gray100': Color(255, 255, 255),
|
||||
'gray11': Color(28, 28, 28),
|
||||
'gray12': Color(31, 31, 31),
|
||||
'gray13': Color(33, 33, 33),
|
||||
'gray14': Color(36, 36, 36),
|
||||
'gray15': Color(38, 38, 38),
|
||||
'gray16': Color(41, 41, 41),
|
||||
'gray17': Color(43, 43, 43),
|
||||
'gray18': Color(46, 46, 46),
|
||||
'gray19': Color(48, 48, 48),
|
||||
'gray2': Color(5, 5, 5),
|
||||
'gray20': Color(51, 51, 51),
|
||||
'gray21': Color(54, 54, 54),
|
||||
'gray22': Color(56, 56, 56),
|
||||
'gray23': Color(59, 59, 59),
|
||||
'gray24': Color(61, 61, 61),
|
||||
'gray25': Color(64, 64, 64),
|
||||
'gray26': Color(66, 66, 66),
|
||||
'gray27': Color(69, 69, 69),
|
||||
'gray28': Color(71, 71, 71),
|
||||
'gray29': Color(74, 74, 74),
|
||||
'gray3': Color(8, 8, 8),
|
||||
'gray30': Color(77, 77, 77),
|
||||
'gray31': Color(79, 79, 79),
|
||||
'gray32': Color(82, 82, 82),
|
||||
'gray33': Color(84, 84, 84),
|
||||
'gray34': Color(87, 87, 87),
|
||||
'gray35': Color(89, 89, 89),
|
||||
'gray36': Color(92, 92, 92),
|
||||
'gray37': Color(94, 94, 94),
|
||||
'gray38': Color(97, 97, 97),
|
||||
'gray39': Color(99, 99, 99),
|
||||
'gray4': Color(10, 10, 10),
|
||||
'gray40': Color(102, 102, 102),
|
||||
'gray41': Color(105, 105, 105),
|
||||
'gray42': Color(107, 107, 107),
|
||||
'gray43': Color(110, 110, 110),
|
||||
'gray44': Color(112, 112, 112),
|
||||
'gray45': Color(115, 115, 115),
|
||||
'gray46': Color(117, 117, 117),
|
||||
'gray47': Color(120, 120, 120),
|
||||
'gray48': Color(122, 122, 122),
|
||||
'gray49': Color(125, 125, 125),
|
||||
'gray5': Color(13, 13, 13),
|
||||
'gray50': Color(127, 127, 127),
|
||||
'gray51': Color(130, 130, 130),
|
||||
'gray52': Color(133, 133, 133),
|
||||
'gray53': Color(135, 135, 135),
|
||||
'gray54': Color(138, 138, 138),
|
||||
'gray55': Color(140, 140, 140),
|
||||
'gray56': Color(143, 143, 143),
|
||||
'gray57': Color(145, 145, 145),
|
||||
'gray58': Color(148, 148, 148),
|
||||
'gray59': Color(150, 150, 150),
|
||||
'gray6': Color(15, 15, 15),
|
||||
'gray60': Color(153, 153, 153),
|
||||
'gray61': Color(156, 156, 156),
|
||||
'gray62': Color(158, 158, 158),
|
||||
'gray63': Color(161, 161, 161),
|
||||
'gray64': Color(163, 163, 163),
|
||||
'gray65': Color(166, 166, 166),
|
||||
'gray66': Color(168, 168, 168),
|
||||
'gray67': Color(171, 171, 171),
|
||||
'gray68': Color(173, 173, 173),
|
||||
'gray69': Color(176, 176, 176),
|
||||
'gray7': Color(18, 18, 18),
|
||||
'gray70': Color(179, 179, 179),
|
||||
'gray71': Color(181, 181, 181),
|
||||
'gray72': Color(184, 184, 184),
|
||||
'gray73': Color(186, 186, 186),
|
||||
'gray74': Color(189, 189, 189),
|
||||
'gray75': Color(191, 191, 191),
|
||||
'gray76': Color(194, 194, 194),
|
||||
'gray77': Color(196, 196, 196),
|
||||
'gray78': Color(199, 199, 199),
|
||||
'gray79': Color(201, 201, 201),
|
||||
'gray8': Color(20, 20, 20),
|
||||
'gray80': Color(204, 204, 204),
|
||||
'gray81': Color(207, 207, 207),
|
||||
'gray82': Color(209, 209, 209),
|
||||
'gray83': Color(212, 212, 212),
|
||||
'gray84': Color(214, 214, 214),
|
||||
'gray85': Color(217, 217, 217),
|
||||
'gray86': Color(219, 219, 219),
|
||||
'gray87': Color(222, 222, 222),
|
||||
'gray88': Color(224, 224, 224),
|
||||
'gray89': Color(227, 227, 227),
|
||||
'gray9': Color(23, 23, 23),
|
||||
'gray90': Color(229, 229, 229),
|
||||
'gray91': Color(232, 232, 232),
|
||||
'gray92': Color(235, 235, 235),
|
||||
'gray93': Color(237, 237, 237),
|
||||
'gray94': Color(240, 240, 240),
|
||||
'gray95': Color(242, 242, 242),
|
||||
'gray96': Color(245, 245, 245),
|
||||
'gray97': Color(247, 247, 247),
|
||||
'gray98': Color(250, 250, 250),
|
||||
'gray99': Color(252, 252, 252),
|
||||
'green': Color(0, 255, 0),
|
||||
'green yellow': Color(173, 255, 47),
|
||||
'green1': Color(0, 255, 0),
|
||||
'green2': Color(0, 238, 0),
|
||||
'green3': Color(0, 205, 0),
|
||||
'green4': Color(0, 139, 0),
|
||||
'greenyellow': Color(173, 255, 47),
|
||||
'grey': Color(190, 190, 190),
|
||||
'grey0': Color(0, 0, 0),
|
||||
'grey1': Color(3, 3, 3),
|
||||
'grey10': Color(26, 26, 26),
|
||||
'grey100': Color(255, 255, 255),
|
||||
'grey11': Color(28, 28, 28),
|
||||
'grey12': Color(31, 31, 31),
|
||||
'grey13': Color(33, 33, 33),
|
||||
'grey14': Color(36, 36, 36),
|
||||
'grey15': Color(38, 38, 38),
|
||||
'grey16': Color(41, 41, 41),
|
||||
'grey17': Color(43, 43, 43),
|
||||
'grey18': Color(46, 46, 46),
|
||||
'grey19': Color(48, 48, 48),
|
||||
'grey2': Color(5, 5, 5),
|
||||
'grey20': Color(51, 51, 51),
|
||||
'grey21': Color(54, 54, 54),
|
||||
'grey22': Color(56, 56, 56),
|
||||
'grey23': Color(59, 59, 59),
|
||||
'grey24': Color(61, 61, 61),
|
||||
'grey25': Color(64, 64, 64),
|
||||
'grey26': Color(66, 66, 66),
|
||||
'grey27': Color(69, 69, 69),
|
||||
'grey28': Color(71, 71, 71),
|
||||
'grey29': Color(74, 74, 74),
|
||||
'grey3': Color(8, 8, 8),
|
||||
'grey30': Color(77, 77, 77),
|
||||
'grey31': Color(79, 79, 79),
|
||||
'grey32': Color(82, 82, 82),
|
||||
'grey33': Color(84, 84, 84),
|
||||
'grey34': Color(87, 87, 87),
|
||||
'grey35': Color(89, 89, 89),
|
||||
'grey36': Color(92, 92, 92),
|
||||
'grey37': Color(94, 94, 94),
|
||||
'grey38': Color(97, 97, 97),
|
||||
'grey39': Color(99, 99, 99),
|
||||
'grey4': Color(10, 10, 10),
|
||||
'grey40': Color(102, 102, 102),
|
||||
'grey41': Color(105, 105, 105),
|
||||
'grey42': Color(107, 107, 107),
|
||||
'grey43': Color(110, 110, 110),
|
||||
'grey44': Color(112, 112, 112),
|
||||
'grey45': Color(115, 115, 115),
|
||||
'grey46': Color(117, 117, 117),
|
||||
'grey47': Color(120, 120, 120),
|
||||
'grey48': Color(122, 122, 122),
|
||||
'grey49': Color(125, 125, 125),
|
||||
'grey5': Color(13, 13, 13),
|
||||
'grey50': Color(127, 127, 127),
|
||||
'grey51': Color(130, 130, 130),
|
||||
'grey52': Color(133, 133, 133),
|
||||
'grey53': Color(135, 135, 135),
|
||||
'grey54': Color(138, 138, 138),
|
||||
'grey55': Color(140, 140, 140),
|
||||
'grey56': Color(143, 143, 143),
|
||||
'grey57': Color(145, 145, 145),
|
||||
'grey58': Color(148, 148, 148),
|
||||
'grey59': Color(150, 150, 150),
|
||||
'grey6': Color(15, 15, 15),
|
||||
'grey60': Color(153, 153, 153),
|
||||
'grey61': Color(156, 156, 156),
|
||||
'grey62': Color(158, 158, 158),
|
||||
'grey63': Color(161, 161, 161),
|
||||
'grey64': Color(163, 163, 163),
|
||||
'grey65': Color(166, 166, 166),
|
||||
'grey66': Color(168, 168, 168),
|
||||
'grey67': Color(171, 171, 171),
|
||||
'grey68': Color(173, 173, 173),
|
||||
'grey69': Color(176, 176, 176),
|
||||
'grey7': Color(18, 18, 18),
|
||||
'grey70': Color(179, 179, 179),
|
||||
'grey71': Color(181, 181, 181),
|
||||
'grey72': Color(184, 184, 184),
|
||||
'grey73': Color(186, 186, 186),
|
||||
'grey74': Color(189, 189, 189),
|
||||
'grey75': Color(191, 191, 191),
|
||||
'grey76': Color(194, 194, 194),
|
||||
'grey77': Color(196, 196, 196),
|
||||
'grey78': Color(199, 199, 199),
|
||||
'grey79': Color(201, 201, 201),
|
||||
'grey8': Color(20, 20, 20),
|
||||
'grey80': Color(204, 204, 204),
|
||||
'grey81': Color(207, 207, 207),
|
||||
'grey82': Color(209, 209, 209),
|
||||
'grey83': Color(212, 212, 212),
|
||||
'grey84': Color(214, 214, 214),
|
||||
'grey85': Color(217, 217, 217),
|
||||
'grey86': Color(219, 219, 219),
|
||||
'grey87': Color(222, 222, 222),
|
||||
'grey88': Color(224, 224, 224),
|
||||
'grey89': Color(227, 227, 227),
|
||||
'grey9': Color(23, 23, 23),
|
||||
'grey90': Color(229, 229, 229),
|
||||
'grey91': Color(232, 232, 232),
|
||||
'grey92': Color(235, 235, 235),
|
||||
'grey93': Color(237, 237, 237),
|
||||
'grey94': Color(240, 240, 240),
|
||||
'grey95': Color(242, 242, 242),
|
||||
'grey96': Color(245, 245, 245),
|
||||
'grey97': Color(247, 247, 247),
|
||||
'grey98': Color(250, 250, 250),
|
||||
'grey99': Color(252, 252, 252),
|
||||
'honeydew': Color(240, 255, 240),
|
||||
'honeydew1': Color(240, 255, 240),
|
||||
'honeydew2': Color(224, 238, 224),
|
||||
'honeydew3': Color(193, 205, 193),
|
||||
'honeydew4': Color(131, 139, 131),
|
||||
'hot pink': Color(255, 105, 180),
|
||||
'hotpink': Color(255, 105, 180),
|
||||
'hotpink1': Color(255, 110, 180),
|
||||
'hotpink2': Color(238, 106, 167),
|
||||
'hotpink3': Color(205, 96, 144),
|
||||
'hotpink4': Color(139, 58, 98),
|
||||
'indian red': Color(205, 92, 92),
|
||||
'indianred': Color(205, 92, 92),
|
||||
'indianred1': Color(255, 106, 106),
|
||||
'indianred2': Color(238, 99, 99),
|
||||
'indianred3': Color(205, 85, 85),
|
||||
'indianred4': Color(139, 58, 58),
|
||||
'ivory': Color(255, 255, 240),
|
||||
'ivory1': Color(255, 255, 240),
|
||||
'ivory2': Color(238, 238, 224),
|
||||
'ivory3': Color(205, 205, 193),
|
||||
'ivory4': Color(139, 139, 131),
|
||||
'khaki': Color(240, 230, 140),
|
||||
'khaki1': Color(255, 246, 143),
|
||||
'khaki2': Color(238, 230, 133),
|
||||
'khaki3': Color(205, 198, 115),
|
||||
'khaki4': Color(139, 134, 78),
|
||||
'lavender': Color(230, 230, 250),
|
||||
'lavender blush': Color(255, 240, 245),
|
||||
'lavenderblush': Color(255, 240, 245),
|
||||
'lavenderblush1': Color(255, 240, 245),
|
||||
'lavenderblush2': Color(238, 224, 229),
|
||||
'lavenderblush3': Color(205, 193, 197),
|
||||
'lavenderblush4': Color(139, 131, 134),
|
||||
'lawn green': Color(124, 252, 0),
|
||||
'lawngreen': Color(124, 252, 0),
|
||||
'lemon chiffon': Color(255, 250, 205),
|
||||
'lemonchiffon': Color(255, 250, 205),
|
||||
'lemonchiffon1': Color(255, 250, 205),
|
||||
'lemonchiffon2': Color(238, 233, 191),
|
||||
'lemonchiffon3': Color(205, 201, 165),
|
||||
'lemonchiffon4': Color(139, 137, 112),
|
||||
'light blue': Color(173, 216, 230),
|
||||
'light coral': Color(240, 128, 128),
|
||||
'light cyan': Color(224, 255, 255),
|
||||
'light goldenrod': Color(238, 221, 130),
|
||||
'light goldenrod yellow': Color(250, 250, 210),
|
||||
'light gray': Color(211, 211, 211),
|
||||
'light green': Color(144, 238, 144),
|
||||
'light grey': Color(211, 211, 211),
|
||||
'light pink': Color(255, 182, 193),
|
||||
'light salmon': Color(255, 160, 122),
|
||||
'light sea green': Color(32, 178, 170),
|
||||
'light sky blue': Color(135, 206, 250),
|
||||
'light slate blue': Color(132, 112, 255),
|
||||
'light slate gray': Color(119, 136, 153),
|
||||
'light slate grey': Color(119, 136, 153),
|
||||
'light steel blue': Color(176, 196, 222),
|
||||
'light yellow': Color(255, 255, 224),
|
||||
'lightblue': Color(173, 216, 230),
|
||||
'lightblue1': Color(191, 239, 255),
|
||||
'lightblue2': Color(178, 223, 238),
|
||||
'lightblue3': Color(154, 192, 205),
|
||||
'lightblue4': Color(104, 131, 139),
|
||||
'lightcoral': Color(240, 128, 128),
|
||||
'lightcyan': Color(224, 255, 255),
|
||||
'lightcyan1': Color(224, 255, 255),
|
||||
'lightcyan2': Color(209, 238, 238),
|
||||
'lightcyan3': Color(180, 205, 205),
|
||||
'lightcyan4': Color(122, 139, 139),
|
||||
'lightgoldenrod': Color(238, 221, 130),
|
||||
'lightgoldenrod1': Color(255, 236, 139),
|
||||
'lightgoldenrod2': Color(238, 220, 130),
|
||||
'lightgoldenrod3': Color(205, 190, 112),
|
||||
'lightgoldenrod4': Color(139, 129, 76),
|
||||
'lightgoldenrodyellow': Color(250, 250, 210),
|
||||
'lightgray': Color(211, 211, 211),
|
||||
'lightgreen': Color(144, 238, 144),
|
||||
'lightgrey': Color(211, 211, 211),
|
||||
'lightpink': Color(255, 182, 193),
|
||||
'lightpink1': Color(255, 174, 185),
|
||||
'lightpink2': Color(238, 162, 173),
|
||||
'lightpink3': Color(205, 140, 149),
|
||||
'lightpink4': Color(139, 95, 101),
|
||||
'lightsalmon': Color(255, 160, 122),
|
||||
'lightsalmon1': Color(255, 160, 122),
|
||||
'lightsalmon2': Color(238, 149, 114),
|
||||
'lightsalmon3': Color(205, 129, 98),
|
||||
'lightsalmon4': Color(139, 87, 66),
|
||||
'lightseagreen': Color(32, 178, 170),
|
||||
'lightskyblue': Color(135, 206, 250),
|
||||
'lightskyblue1': Color(176, 226, 255),
|
||||
'lightskyblue2': Color(164, 211, 238),
|
||||
'lightskyblue3': Color(141, 182, 205),
|
||||
'lightskyblue4': Color(96, 123, 139),
|
||||
'lightslateblue': Color(132, 112, 255),
|
||||
'lightslategray': Color(119, 136, 153),
|
||||
'lightslategrey': Color(119, 136, 153),
|
||||
'lightsteelblue': Color(176, 196, 222),
|
||||
'lightsteelblue1': Color(202, 225, 255),
|
||||
'lightsteelblue2': Color(188, 210, 238),
|
||||
'lightsteelblue3': Color(162, 181, 205),
|
||||
'lightsteelblue4': Color(110, 123, 139),
|
||||
'lightyellow': Color(255, 255, 224),
|
||||
'lightyellow1': Color(255, 255, 224),
|
||||
'lightyellow2': Color(238, 238, 209),
|
||||
'lightyellow3': Color(205, 205, 180),
|
||||
'lightyellow4': Color(139, 139, 122),
|
||||
'lime green': Color(50, 205, 50),
|
||||
'limegreen': Color(50, 205, 50),
|
||||
'linen': Color(250, 240, 230),
|
||||
'magenta': Color(255, 0, 255),
|
||||
'magenta1': Color(255, 0, 255),
|
||||
'magenta2': Color(238, 0, 238),
|
||||
'magenta3': Color(205, 0, 205),
|
||||
'magenta4': Color(139, 0, 139),
|
||||
'maroon': Color(176, 48, 96),
|
||||
'maroon1': Color(255, 52, 179),
|
||||
'maroon2': Color(238, 48, 167),
|
||||
'maroon3': Color(205, 41, 144),
|
||||
'maroon4': Color(139, 28, 98),
|
||||
'medium aquamarine': Color(102, 205, 170),
|
||||
'medium blue': Color(0, 0, 205),
|
||||
'medium orchid': Color(186, 85, 211),
|
||||
'medium purple': Color(147, 112, 219),
|
||||
'medium sea green': Color(60, 179, 113),
|
||||
'medium slate blue': Color(123, 104, 238),
|
||||
'medium spring green': Color(0, 250, 154),
|
||||
'medium turquoise': Color(72, 209, 204),
|
||||
'medium violet red': Color(199, 21, 133),
|
||||
'mediumaquamarine': Color(102, 205, 170),
|
||||
'mediumblue': Color(0, 0, 205),
|
||||
'mediumorchid': Color(186, 85, 211),
|
||||
'mediumorchid1': Color(224, 102, 255),
|
||||
'mediumorchid2': Color(209, 95, 238),
|
||||
'mediumorchid3': Color(180, 82, 205),
|
||||
'mediumorchid4': Color(122, 55, 139),
|
||||
'mediumpurple': Color(147, 112, 219),
|
||||
'mediumpurple1': Color(171, 130, 255),
|
||||
'mediumpurple2': Color(159, 121, 238),
|
||||
'mediumpurple3': Color(137, 104, 205),
|
||||
'mediumpurple4': Color(93, 71, 139),
|
||||
'mediumseagreen': Color(60, 179, 113),
|
||||
'mediumslateblue': Color(123, 104, 238),
|
||||
'mediumspringgreen': Color(0, 250, 154),
|
||||
'mediumturquoise': Color(72, 209, 204),
|
||||
'mediumvioletred': Color(199, 21, 133),
|
||||
'midnight blue': Color(25, 25, 112),
|
||||
'midnightblue': Color(25, 25, 112),
|
||||
'mint cream': Color(245, 255, 250),
|
||||
'mintcream': Color(245, 255, 250),
|
||||
'misty rose': Color(255, 228, 225),
|
||||
'mistyrose': Color(255, 228, 225),
|
||||
'mistyrose1': Color(255, 228, 225),
|
||||
'mistyrose2': Color(238, 213, 210),
|
||||
'mistyrose3': Color(205, 183, 181),
|
||||
'mistyrose4': Color(139, 125, 123),
|
||||
'moccasin': Color(255, 228, 181),
|
||||
'navajo white': Color(255, 222, 173),
|
||||
'navajowhite': Color(255, 222, 173),
|
||||
'navajowhite1': Color(255, 222, 173),
|
||||
'navajowhite2': Color(238, 207, 161),
|
||||
'navajowhite3': Color(205, 179, 139),
|
||||
'navajowhite4': Color(139, 121, 94),
|
||||
'navy': Color(0, 0, 128),
|
||||
'navy blue': Color(0, 0, 128),
|
||||
'navyblue': Color(0, 0, 128),
|
||||
'old lace': Color(253, 245, 230),
|
||||
'oldlace': Color(253, 245, 230),
|
||||
'olive drab': Color(107, 142, 35),
|
||||
'olivedrab': Color(107, 142, 35),
|
||||
'olivedrab1': Color(192, 255, 62),
|
||||
'olivedrab2': Color(179, 238, 58),
|
||||
'olivedrab3': Color(154, 205, 50),
|
||||
'olivedrab4': Color(105, 139, 34),
|
||||
'orange': Color(255, 165, 0),
|
||||
'orange red': Color(255, 69, 0),
|
||||
'orange1': Color(255, 165, 0),
|
||||
'orange2': Color(238, 154, 0),
|
||||
'orange3': Color(205, 133, 0),
|
||||
'orange4': Color(139, 90, 0),
|
||||
'orangered': Color(255, 69, 0),
|
||||
'orangered1': Color(255, 69, 0),
|
||||
'orangered2': Color(238, 64, 0),
|
||||
'orangered3': Color(205, 55, 0),
|
||||
'orangered4': Color(139, 37, 0),
|
||||
'orchid': Color(218, 112, 214),
|
||||
'orchid1': Color(255, 131, 250),
|
||||
'orchid2': Color(238, 122, 233),
|
||||
'orchid3': Color(205, 105, 201),
|
||||
'orchid4': Color(139, 71, 137),
|
||||
'pale goldenrod': Color(238, 232, 170),
|
||||
'pale green': Color(152, 251, 152),
|
||||
'pale turquoise': Color(175, 238, 238),
|
||||
'pale violet red': Color(219, 112, 147),
|
||||
'palegoldenrod': Color(238, 232, 170),
|
||||
'palegreen': Color(152, 251, 152),
|
||||
'palegreen1': Color(154, 255, 154),
|
||||
'palegreen2': Color(144, 238, 144),
|
||||
'palegreen3': Color(124, 205, 124),
|
||||
'palegreen4': Color(84, 139, 84),
|
||||
'paleturquoise': Color(175, 238, 238),
|
||||
'paleturquoise1': Color(187, 255, 255),
|
||||
'paleturquoise2': Color(174, 238, 238),
|
||||
'paleturquoise3': Color(150, 205, 205),
|
||||
'paleturquoise4': Color(102, 139, 139),
|
||||
'palevioletred': Color(219, 112, 147),
|
||||
'palevioletred1': Color(255, 130, 171),
|
||||
'palevioletred2': Color(238, 121, 159),
|
||||
'palevioletred3': Color(205, 104, 137),
|
||||
'palevioletred4': Color(139, 71, 93),
|
||||
'papaya whip': Color(255, 239, 213),
|
||||
'papayawhip': Color(255, 239, 213),
|
||||
'peach puff': Color(255, 218, 185),
|
||||
'peachpuff': Color(255, 218, 185),
|
||||
'peachpuff1': Color(255, 218, 185),
|
||||
'peachpuff2': Color(238, 203, 173),
|
||||
'peachpuff3': Color(205, 175, 149),
|
||||
'peachpuff4': Color(139, 119, 101),
|
||||
'peru': Color(205, 133, 63),
|
||||
'pink': Color(255, 192, 203),
|
||||
'pink1': Color(255, 181, 197),
|
||||
'pink2': Color(238, 169, 184),
|
||||
'pink3': Color(205, 145, 158),
|
||||
'pink4': Color(139, 99, 108),
|
||||
'plum': Color(221, 160, 221),
|
||||
'plum1': Color(255, 187, 255),
|
||||
'plum2': Color(238, 174, 238),
|
||||
'plum3': Color(205, 150, 205),
|
||||
'plum4': Color(139, 102, 139),
|
||||
'powder blue': Color(176, 224, 230),
|
||||
'powderblue': Color(176, 224, 230),
|
||||
'purple': Color(160, 32, 240),
|
||||
'purple1': Color(155, 48, 255),
|
||||
'purple2': Color(145, 44, 238),
|
||||
'purple3': Color(125, 38, 205),
|
||||
'purple4': Color(85, 26, 139),
|
||||
'red': Color(255, 0, 0),
|
||||
'red1': Color(255, 0, 0),
|
||||
'red2': Color(238, 0, 0),
|
||||
'red3': Color(205, 0, 0),
|
||||
'red4': Color(139, 0, 0),
|
||||
'rosy brown': Color(188, 143, 143),
|
||||
'rosybrown': Color(188, 143, 143),
|
||||
'rosybrown1': Color(255, 193, 193),
|
||||
'rosybrown2': Color(238, 180, 180),
|
||||
'rosybrown3': Color(205, 155, 155),
|
||||
'rosybrown4': Color(139, 105, 105),
|
||||
'royal blue': Color(65, 105, 225),
|
||||
'royalblue': Color(65, 105, 225),
|
||||
'royalblue1': Color(72, 118, 255),
|
||||
'royalblue2': Color(67, 110, 238),
|
||||
'royalblue3': Color(58, 95, 205),
|
||||
'royalblue4': Color(39, 64, 139),
|
||||
'saddle brown': Color(139, 69, 19),
|
||||
'saddlebrown': Color(139, 69, 19),
|
||||
'salmon': Color(250, 128, 114),
|
||||
'salmon1': Color(255, 140, 105),
|
||||
'salmon2': Color(238, 130, 98),
|
||||
'salmon3': Color(205, 112, 84),
|
||||
'salmon4': Color(139, 76, 57),
|
||||
'sandy brown': Color(244, 164, 96),
|
||||
'sandybrown': Color(244, 164, 96),
|
||||
'sea green': Color(46, 139, 87),
|
||||
'seagreen': Color(46, 139, 87),
|
||||
'seagreen1': Color(84, 255, 159),
|
||||
'seagreen2': Color(78, 238, 148),
|
||||
'seagreen3': Color(67, 205, 128),
|
||||
'seagreen4': Color(46, 139, 87),
|
||||
'seashell': Color(255, 245, 238),
|
||||
'seashell1': Color(255, 245, 238),
|
||||
'seashell2': Color(238, 229, 222),
|
||||
'seashell3': Color(205, 197, 191),
|
||||
'seashell4': Color(139, 134, 130),
|
||||
'sienna': Color(160, 82, 45),
|
||||
'sienna1': Color(255, 130, 71),
|
||||
'sienna2': Color(238, 121, 66),
|
||||
'sienna3': Color(205, 104, 57),
|
||||
'sienna4': Color(139, 71, 38),
|
||||
'sky blue': Color(135, 206, 235),
|
||||
'skyblue': Color(135, 206, 235),
|
||||
'skyblue1': Color(135, 206, 255),
|
||||
'skyblue2': Color(126, 192, 238),
|
||||
'skyblue3': Color(108, 166, 205),
|
||||
'skyblue4': Color(74, 112, 139),
|
||||
'slate blue': Color(106, 90, 205),
|
||||
'slate gray': Color(112, 128, 144),
|
||||
'slate grey': Color(112, 128, 144),
|
||||
'slateblue': Color(106, 90, 205),
|
||||
'slateblue1': Color(131, 111, 255),
|
||||
'slateblue2': Color(122, 103, 238),
|
||||
'slateblue3': Color(105, 89, 205),
|
||||
'slateblue4': Color(71, 60, 139),
|
||||
'slategray': Color(112, 128, 144),
|
||||
'slategray1': Color(198, 226, 255),
|
||||
'slategray2': Color(185, 211, 238),
|
||||
'slategray3': Color(159, 182, 205),
|
||||
'slategray4': Color(108, 123, 139),
|
||||
'slategrey': Color(112, 128, 144),
|
||||
'snow': Color(255, 250, 250),
|
||||
'snow1': Color(255, 250, 250),
|
||||
'snow2': Color(238, 233, 233),
|
||||
'snow3': Color(205, 201, 201),
|
||||
'snow4': Color(139, 137, 137),
|
||||
'spring green': Color(0, 255, 127),
|
||||
'springgreen': Color(0, 255, 127),
|
||||
'springgreen1': Color(0, 255, 127),
|
||||
'springgreen2': Color(0, 238, 118),
|
||||
'springgreen3': Color(0, 205, 102),
|
||||
'springgreen4': Color(0, 139, 69),
|
||||
'steel blue': Color(70, 130, 180),
|
||||
'steelblue': Color(70, 130, 180),
|
||||
'steelblue1': Color(99, 184, 255),
|
||||
'steelblue2': Color(92, 172, 238),
|
||||
'steelblue3': Color(79, 148, 205),
|
||||
'steelblue4': Color(54, 100, 139),
|
||||
'tan': Color(210, 180, 140),
|
||||
'tan1': Color(255, 165, 79),
|
||||
'tan2': Color(238, 154, 73),
|
||||
'tan3': Color(205, 133, 63),
|
||||
'tan4': Color(139, 90, 43),
|
||||
'thistle': Color(216, 191, 216),
|
||||
'thistle1': Color(255, 225, 255),
|
||||
'thistle2': Color(238, 210, 238),
|
||||
'thistle3': Color(205, 181, 205),
|
||||
'thistle4': Color(139, 123, 139),
|
||||
'tomato': Color(255, 99, 71),
|
||||
'tomato1': Color(255, 99, 71),
|
||||
'tomato2': Color(238, 92, 66),
|
||||
'tomato3': Color(205, 79, 57),
|
||||
'tomato4': Color(139, 54, 38),
|
||||
'turquoise': Color(64, 224, 208),
|
||||
'turquoise1': Color(0, 245, 255),
|
||||
'turquoise2': Color(0, 229, 238),
|
||||
'turquoise3': Color(0, 197, 205),
|
||||
'turquoise4': Color(0, 134, 139),
|
||||
'violet': Color(238, 130, 238),
|
||||
'violet red': Color(208, 32, 144),
|
||||
'violetred': Color(208, 32, 144),
|
||||
'violetred1': Color(255, 62, 150),
|
||||
'violetred2': Color(238, 58, 140),
|
||||
'violetred3': Color(205, 50, 120),
|
||||
'violetred4': Color(139, 34, 82),
|
||||
'wheat': Color(245, 222, 179),
|
||||
'wheat1': Color(255, 231, 186),
|
||||
'wheat2': Color(238, 216, 174),
|
||||
'wheat3': Color(205, 186, 150),
|
||||
'wheat4': Color(139, 126, 102),
|
||||
'white': Color(255, 255, 255),
|
||||
'white smoke': Color(245, 245, 245),
|
||||
'whitesmoke': Color(245, 245, 245),
|
||||
'yellow': Color(255, 255, 0),
|
||||
'yellow green': Color(154, 205, 50),
|
||||
'yellow1': Color(255, 255, 0),
|
||||
'yellow2': Color(238, 238, 0),
|
||||
'yellow3': Color(205, 205, 0),
|
||||
'yellow4': Color(139, 139, 0),
|
||||
'yellowgreen': Color(154, 205, 50)}
|
||||
# END_DATA_SECTION }}}
|
||||
|
||||
if __name__ == '__main__':
|
||||
# Read RGB color table from specified rgb.txt file
|
||||
import sys
|
||||
import pprint
|
||||
data = {}
|
||||
for line in open(sys.argv[-1]):
|
||||
line = line.strip()
|
||||
if not line or line.startswith('!'):
|
||||
continue
|
||||
parts = line.split()
|
||||
r, g, b = map(int, parts[:3])
|
||||
name = ' '.join(parts[3:]).lower()
|
||||
data[name] = data[name.replace(' ', '')] = r, g, b
|
||||
data = pprint.pformat(data).replace('{', '{\n ').replace('(', 'Color(')
|
||||
with open(__file__, 'r+') as src:
|
||||
raw = src.read()
|
||||
raw = re.sub(
|
||||
r'^# BEGIN_DATA_SECTION {{{$.*^# END_DATA_SECTION }}}',
|
||||
'# BEGIN_DATA_SECTION {{{\ncolor_names = %s\n# END_DATA_SECTION }}}' % data,
|
||||
raw, flags=re.DOTALL | re.MULTILINE
|
||||
)
|
||||
src.seek(0), src.truncate(), src.write(raw)
|
||||
@@ -44,6 +44,9 @@ new(PyTypeObject *type, PyObject *args, PyObject UNUSED *kwds) {
|
||||
self->columns = columns; self->lines = lines;
|
||||
self->modes = empty_modes;
|
||||
self->margin_top = 0; self->margin_bottom = self->lines - 1;
|
||||
self->default_fg = 0; self->default_bg = 0;
|
||||
self->highlight_fg = 0; self->highlight_bg = 0;
|
||||
self->cursor_color = 0;
|
||||
RESET_CHARSETS;
|
||||
self->callbacks = callbacks; Py_INCREF(callbacks);
|
||||
self->cursor = alloc_cursor();
|
||||
@@ -68,6 +71,9 @@ screen_reset(Screen *self) {
|
||||
if (self->linebuf == self->alt_linebuf) screen_toggle_screen_buffer(self);
|
||||
linebuf_clear(self->linebuf, ' ');
|
||||
self->modes = empty_modes;
|
||||
self->default_fg = 0; self->default_bg = 0;
|
||||
self->highlight_fg = 0; self->highlight_bg = 0;
|
||||
self->cursor_color = 0;
|
||||
RESET_CHARSETS;
|
||||
self->margin_top = 0; self->margin_bottom = self->lines - 1;
|
||||
screen_normal_keypad_mode(self);
|
||||
@@ -881,8 +887,17 @@ callback(const char *name, Screen *self, const char *data, unsigned int sz) {
|
||||
}
|
||||
|
||||
void
|
||||
report_device_attributes(Screen *self, unsigned int UNUSED mode, bool UNUSED secondary) {
|
||||
callback("write_to_child", self, "\x1b[>1;4600;0c", 0); // same as libvte
|
||||
report_device_attributes(Screen *self, unsigned int mode, char start_modifier) {
|
||||
if (mode == 0) {
|
||||
switch(start_modifier) {
|
||||
case 0:
|
||||
callback("write_to_child", self, "\x1b[?62;c", 0); // VT-220 with no extra info
|
||||
break;
|
||||
case '>':
|
||||
callback("write_to_child", self, "\x1b[>1;" xstr(PRIMARY_VERSION) ";" xstr(SECONDARY_VERSION) "c", 0); // VT-220 + primary version + secondary version
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1304,6 +1319,11 @@ static PyMemberDef members[] = {
|
||||
{"columns", T_UINT, offsetof(Screen, columns), READONLY, "columns"},
|
||||
{"margin_top", T_UINT, offsetof(Screen, margin_top), READONLY, "margin_top"},
|
||||
{"margin_bottom", T_UINT, offsetof(Screen, margin_bottom), READONLY, "margin_bottom"},
|
||||
{"default_fg", T_ULONG, offsetof(Screen, default_fg), 0, "default_fg"},
|
||||
{"default_bg", T_ULONG, offsetof(Screen, default_bg), 0, "default_bg"},
|
||||
{"highlight_fg", T_ULONG, offsetof(Screen, highlight_fg), 0, "highlight_fg"},
|
||||
{"highlight_bg", T_ULONG, offsetof(Screen, highlight_bg), 0, "highlight_bg"},
|
||||
{"cursor_color", T_ULONG, offsetof(Screen, cursor_color), 0, "cursor_color"},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
|
||||
@@ -160,8 +160,8 @@ update_cell_range_data(ScreenModes *modes, SpriteMap *self, Line *line, unsigned
|
||||
data[offset] = sp->x;
|
||||
data[offset+1] = sp->y;
|
||||
data[offset+2] = sp->z;
|
||||
data[offset+(reverse ? 4 : 3)] = to_color(color_profile, line->colors[i] & COL_MASK, default_fg);
|
||||
data[offset+(reverse ? 3 : 4)] = to_color(color_profile, line->colors[i] >> COL_SHIFT, default_bg);
|
||||
data[offset+(reverse ? 4 : 3)] = to_color(color_profile, line->fg_colors[i] & COL_MASK, default_fg);
|
||||
data[offset+(reverse ? 3 : 4)] = to_color(color_profile, line->bg_colors[i] & COL_MASK, default_bg);
|
||||
unsigned int decoration_fg = to_color(color_profile, line->decoration_fg[i] & COL_MASK, data[offset+3]);
|
||||
data[offset+5] = (decoration_fg & COL_MASK) | (decoration << 24) | (strikethrough << 26);
|
||||
previous_ch = ch; previous_width = (attrs) & WIDTH_MASK;
|
||||
|
||||
188
kitty/utils.py
188
kitty/utils.py
@@ -9,13 +9,13 @@ import shlex
|
||||
import signal
|
||||
import string
|
||||
import subprocess
|
||||
from collections import namedtuple
|
||||
from contextlib import contextmanager
|
||||
from functools import lru_cache
|
||||
from time import monotonic
|
||||
|
||||
from .constants import isosx
|
||||
from .fast_data_types import glfw_get_physical_dpi, wcwidth as wcwidth_impl
|
||||
from .rgb import Color, to_color
|
||||
|
||||
|
||||
def safe_print(*a, **k):
|
||||
@@ -71,192 +71,14 @@ def get_dpi():
|
||||
return get_dpi.ans
|
||||
|
||||
|
||||
# Color names {{{
|
||||
|
||||
color_pat = re.compile(r'^#([a-fA-F0-9]{3}|[a-fA-F0-9]{6})$')
|
||||
color_pat2 = re.compile(
|
||||
r'rgb:([a-f0-9]{2})/([a-f0-9]{2})/([a-f0-9]{2})$', re.IGNORECASE
|
||||
)
|
||||
|
||||
color_names = {
|
||||
'aliceblue': 'f0f8ff',
|
||||
'antiquewhite': 'faebd7',
|
||||
'aqua': '00ffff',
|
||||
'aquamarine': '7fffd4',
|
||||
'azure': 'f0ffff',
|
||||
'beige': 'f5f5dc',
|
||||
'bisque': 'ffe4c4',
|
||||
'black': '000000',
|
||||
'blanchedalmond': 'ffebcd',
|
||||
'blue': '0000ff',
|
||||
'blueviolet': '8a2be2',
|
||||
'brown': 'a52a2a',
|
||||
'burlywood': 'deb887',
|
||||
'cadetblue': '5f9ea0',
|
||||
'chartreuse': '7fff00',
|
||||
'chocolate': 'd2691e',
|
||||
'coral': 'ff7f50',
|
||||
'cornflowerblue': '6495ed',
|
||||
'cornsilk': 'fff8dc',
|
||||
'crimson': 'dc143c',
|
||||
'cyan': '00ffff',
|
||||
'darkblue': '00008b',
|
||||
'darkcyan': '008b8b',
|
||||
'darkgoldenrod': 'b8860b',
|
||||
'darkgray': 'a9a9a9',
|
||||
'darkgrey': 'a9a9a9',
|
||||
'darkgreen': '006400',
|
||||
'darkkhaki': 'bdb76b',
|
||||
'darkmagenta': '8b008b',
|
||||
'darkolivegreen': '556b2f',
|
||||
'darkorange': 'ff8c00',
|
||||
'darkorchid': '9932cc',
|
||||
'darkred': '8b0000',
|
||||
'darksalmon': 'e9967a',
|
||||
'darkseagreen': '8fbc8f',
|
||||
'darkslateblue': '483d8b',
|
||||
'darkslategray': '2f4f4f',
|
||||
'darkslategrey': '2f4f4f',
|
||||
'darkturquoise': '00ced1',
|
||||
'darkviolet': '9400d3',
|
||||
'deeppink': 'ff1493',
|
||||
'deepskyblue': '00bfff',
|
||||
'dimgray': '696969',
|
||||
'dimgrey': '696969',
|
||||
'dodgerblue': '1e90ff',
|
||||
'firebrick': 'b22222',
|
||||
'floralwhite': 'fffaf0',
|
||||
'forestgreen': '228b22',
|
||||
'fuchsia': 'ff00ff',
|
||||
'gainsboro': 'dcdcdc',
|
||||
'ghostwhite': 'f8f8ff',
|
||||
'gold': 'ffd700',
|
||||
'goldenrod': 'daa520',
|
||||
'gray': '808080',
|
||||
'grey': '808080',
|
||||
'green': '008000',
|
||||
'greenyellow': 'adff2f',
|
||||
'honeydew': 'f0fff0',
|
||||
'hotpink': 'ff69b4',
|
||||
'indianred': 'cd5c5c',
|
||||
'indigo': '4b0082',
|
||||
'ivory': 'fffff0',
|
||||
'khaki': 'f0e68c',
|
||||
'lavender': 'e6e6fa',
|
||||
'lavenderblush': 'fff0f5',
|
||||
'lawngreen': '7cfc00',
|
||||
'lemonchiffon': 'fffacd',
|
||||
'lightblue': 'add8e6',
|
||||
'lightcoral': 'f08080',
|
||||
'lightcyan': 'e0ffff',
|
||||
'lightgoldenrodyellow': 'fafad2',
|
||||
'lightgray': 'd3d3d3',
|
||||
'lightgrey': 'd3d3d3',
|
||||
'lightgreen': '90ee90',
|
||||
'lightpink': 'ffb6c1',
|
||||
'lightsalmon': 'ffa07a',
|
||||
'lightseagreen': '20b2aa',
|
||||
'lightskyblue': '87cefa',
|
||||
'lightslategray': '778899',
|
||||
'lightslategrey': '778899',
|
||||
'lightsteelblue': 'b0c4de',
|
||||
'lightyellow': 'ffffe0',
|
||||
'lime': '00ff00',
|
||||
'limegreen': '32cd32',
|
||||
'linen': 'faf0e6',
|
||||
'magenta': 'ff00ff',
|
||||
'maroon': '800000',
|
||||
'mediumaquamarine': '66cdaa',
|
||||
'mediumblue': '0000cd',
|
||||
'mediumorchid': 'ba55d3',
|
||||
'mediumpurple': '9370db',
|
||||
'mediumseagreen': '3cb371',
|
||||
'mediumslateblue': '7b68ee',
|
||||
'mediumspringgreen': '00fa9a',
|
||||
'mediumturquoise': '48d1cc',
|
||||
'mediumvioletred': 'c71585',
|
||||
'midnightblue': '191970',
|
||||
'mintcream': 'f5fffa',
|
||||
'mistyrose': 'ffe4e1',
|
||||
'moccasin': 'ffe4b5',
|
||||
'navajowhite': 'ffdead',
|
||||
'navy': '000080',
|
||||
'oldlace': 'fdf5e6',
|
||||
'olive': '808000',
|
||||
'olivedrab': '6b8e23',
|
||||
'orange': 'ffa500',
|
||||
'orangered': 'ff4500',
|
||||
'orchid': 'da70d6',
|
||||
'palegoldenrod': 'eee8aa',
|
||||
'palegreen': '98fb98',
|
||||
'paleturquoise': 'afeeee',
|
||||
'palevioletred': 'db7093',
|
||||
'papayawhip': 'ffefd5',
|
||||
'peachpuff': 'ffdab9',
|
||||
'per': 'cd853f',
|
||||
'pink': 'ffc0cb',
|
||||
'plum': 'dda0dd',
|
||||
'powderblue': 'b0e0e6',
|
||||
'purple': '800080',
|
||||
'red': 'ff0000',
|
||||
'rosybrown': 'bc8f8f',
|
||||
'royalblue': '4169e1',
|
||||
'saddlebrown': '8b4513',
|
||||
'salmon': 'fa8072',
|
||||
'sandybrown': 'f4a460',
|
||||
'seagreen': '2e8b57',
|
||||
'seashell': 'fff5ee',
|
||||
'sienna': 'a0522d',
|
||||
'silver': 'c0c0c0',
|
||||
'skyblue': '87ceeb',
|
||||
'slateblue': '6a5acd',
|
||||
'slategray': '708090',
|
||||
'slategrey': '708090',
|
||||
'snow': 'fffafa',
|
||||
'springgreen': '00ff7f',
|
||||
'steelblue': '4682b4',
|
||||
'tan': 'd2b48c',
|
||||
'teal': '008080',
|
||||
'thistle': 'd8bfd8',
|
||||
'tomato': 'ff6347',
|
||||
'turquoise': '40e0d0',
|
||||
'violet': 'ee82ee',
|
||||
'wheat': 'f5deb3',
|
||||
'white': 'ffffff',
|
||||
'whitesmoke': 'f5f5f5',
|
||||
'yellow': 'ffff00',
|
||||
'yellowgreen': '9acd32',
|
||||
}
|
||||
Color = namedtuple('Color', 'red green blue')
|
||||
|
||||
# }}}
|
||||
|
||||
|
||||
def to_color(raw, validate=False):
|
||||
x = raw.strip().lower()
|
||||
m = color_pat.match(x)
|
||||
val = None
|
||||
if m is not None:
|
||||
val = m.group(1)
|
||||
if len(val) == 3:
|
||||
val = ''.join(2 * s for s in val)
|
||||
else:
|
||||
m = color_pat2.match(x)
|
||||
if m is not None:
|
||||
val = m.group(1) + m.group(2) + m.group(3)
|
||||
else:
|
||||
val = color_names.get(x)
|
||||
if val is None:
|
||||
if validate:
|
||||
raise ValueError('Invalid color name: {}'.format(raw))
|
||||
return
|
||||
return Color(int(val[:2], 16), int(val[2:4], 16), int(val[4:], 16))
|
||||
|
||||
|
||||
def color_as_int(val):
|
||||
return val[0] << 16 | val[1] << 8 | val[2]
|
||||
|
||||
|
||||
def color_from_int(val):
|
||||
return Color((val >> 16) & 0xFF, (val >> 8) & 0xFF, val & 0xFF)
|
||||
|
||||
|
||||
def parse_color_set(raw):
|
||||
parts = raw.split(';')
|
||||
for c, spec in [parts[i:i + 2] for i in range(0, len(parts), 2)]:
|
||||
|
||||
@@ -8,7 +8,7 @@ from collections import deque
|
||||
from functools import partial
|
||||
from time import monotonic
|
||||
|
||||
from .char_grid import CharGrid
|
||||
from .char_grid import CharGrid, DynamicColor
|
||||
from .constants import wakeup, get_boss, appname, WindowGeometry, is_key_pressed, mouse_button_pressed, cell_size
|
||||
from .fast_data_types import (
|
||||
BRACKETED_PASTE_START, BRACKETED_PASTE_END, Screen, read_bytes_dump,
|
||||
@@ -22,6 +22,15 @@ from .mouse import encode_mouse_event, PRESS, RELEASE, MOVE, DRAG
|
||||
from .terminfo import get_capabilities
|
||||
from .utils import sanitize_title, get_primary_selection, parse_color_set, safe_print
|
||||
|
||||
DYNAMIC_COLOR_CODES = {
|
||||
10: DynamicColor.default_fg,
|
||||
11: DynamicColor.default_bg,
|
||||
12: DynamicColor.cursor_color,
|
||||
17: DynamicColor.highlight_bg,
|
||||
19: DynamicColor.highlight_fg,
|
||||
}
|
||||
DYNAMIC_COLOR_CODES.update({k+100: v for k, v in DYNAMIC_COLOR_CODES.items()})
|
||||
|
||||
|
||||
class Window:
|
||||
|
||||
@@ -118,7 +127,9 @@ class Window:
|
||||
pass # failure to beep is not critical
|
||||
if self.opts.visual_bell_duration > 0:
|
||||
self.start_visual_bell_at = monotonic()
|
||||
glfw_post_empty_event()
|
||||
tm = get_boss()
|
||||
tm.queue_ui_action(tm.request_attention)
|
||||
glfw_post_empty_event()
|
||||
|
||||
def use_utf8(self, on):
|
||||
self.child.set_iutf8(on)
|
||||
@@ -147,12 +158,11 @@ class Window:
|
||||
pass # TODO: Implement this
|
||||
|
||||
def set_dynamic_color(self, code, value):
|
||||
wmap = {10: 'fg', 11: 'bg', 110: 'fg', 111: 'bg'}
|
||||
if isinstance(value, bytes):
|
||||
value = value.decode('utf-8')
|
||||
color_changes = {}
|
||||
for val in value.split(';'):
|
||||
w = wmap.get(code)
|
||||
w = DYNAMIC_COLOR_CODES.get(code)
|
||||
if w is not None:
|
||||
if code >= 110:
|
||||
val = None
|
||||
@@ -227,7 +237,7 @@ class Window:
|
||||
x, y = max(0, x - self.geometry.left), max(0, y - self.geometry.top)
|
||||
self.last_mouse_cursor_pos = x, y
|
||||
tm = get_boss()
|
||||
tm.queue_ui_action(get_boss().change_mouse_cursor, self.char_grid.has_url_at(x, y))
|
||||
tm.queue_ui_action(tm.change_mouse_cursor, self.char_grid.has_url_at(x, y))
|
||||
if send_event:
|
||||
x, y = self.char_grid.cell_for_pos(x, y)
|
||||
if x is not None:
|
||||
|
||||
64
setup.py
64
setup.py
@@ -53,7 +53,7 @@ def cc_version():
|
||||
ver = tuple(map(int, ver))
|
||||
except Exception:
|
||||
ver = (0, 0)
|
||||
return ver
|
||||
return cc, ver
|
||||
|
||||
|
||||
def get_python_flags(cflags):
|
||||
@@ -88,42 +88,51 @@ def get_python_flags(cflags):
|
||||
return libs
|
||||
|
||||
|
||||
def init_env(debug=False, asan=False, native_optimizations=True):
|
||||
def get_sanitize_args(cc, ccver):
|
||||
sanitize_args = set()
|
||||
sanitize_args.add('-fno-omit-frame-pointer')
|
||||
sanitize_args.add('-fsanitize=address')
|
||||
if (cc == 'gcc' and ccver >= (5, 0)) or cc == 'clang':
|
||||
sanitize_args.add('-fsanitize=undefined')
|
||||
# if cc == 'gcc' or (cc == 'clang' and ccver >= (4, 2)):
|
||||
# sanitize_args.add('-fno-sanitize-recover=all')
|
||||
return sanitize_args
|
||||
|
||||
|
||||
def init_env(debug=False, sanitize=False, native_optimizations=True):
|
||||
global cflags, ldflags, cc, ldpaths
|
||||
native_optimizations = native_optimizations and not asan and not debug
|
||||
ccver = cc_version()
|
||||
native_optimizations = native_optimizations and not sanitize and not debug
|
||||
cc, ccver = cc_version()
|
||||
print('CC:', cc, ccver)
|
||||
stack_protector = '-fstack-protector'
|
||||
if ccver >= (4, 9):
|
||||
if ccver >= (4, 9) and cc == 'gcc':
|
||||
stack_protector += '-strong'
|
||||
missing_braces = ''
|
||||
if ccver < (5, 2):
|
||||
if ccver < (5, 2) and cc == 'gcc':
|
||||
missing_braces = '-Wno-missing-braces'
|
||||
cc = os.environ.get('CC', 'gcc')
|
||||
optimize = '-O3'
|
||||
if debug or asan:
|
||||
optimize = '-ggdb'
|
||||
if asan:
|
||||
optimize += ' -fsanitize=address -fno-omit-frame-pointer'
|
||||
optimize = '-ggdb' if debug or sanitize else '-O3'
|
||||
sanitize_args = get_sanitize_args(cc, ccver) if sanitize else set()
|
||||
cflags = os.environ.get(
|
||||
'OVERRIDE_CFLAGS', (
|
||||
'-Wextra -Wno-missing-field-initializers -Wall -std=c99 -D_XOPEN_SOURCE=700'
|
||||
' -pedantic-errors -Werror {} -DNDEBUG -fwrapv {} {} -pipe {}'
|
||||
' -pedantic-errors -Werror {} {} -DNDEBUG -fwrapv {} {} -pipe {}'
|
||||
).format(
|
||||
optimize, stack_protector, missing_braces, '-march=native'
|
||||
optimize, ' '.join(sanitize_args), stack_protector, missing_braces, '-march=native'
|
||||
if native_optimizations else ''
|
||||
)
|
||||
)
|
||||
cflags = shlex.split(cflags
|
||||
) + shlex.split(sysconfig.get_config_var('CCSHARED'))
|
||||
ldflags = os.environ.get(
|
||||
'OVERRIDE_LDFLAGS', '-Wall ' +
|
||||
('-fsanitize=address' if asan else ('' if debug else '-O3'))
|
||||
'OVERRIDE_LDFLAGS', '-Wall ' + ' '.join(sanitize_args) + ('' if debug else ' -O3')
|
||||
)
|
||||
ldflags = shlex.split(ldflags)
|
||||
cflags += shlex.split(os.environ.get('CFLAGS', ''))
|
||||
ldflags += shlex.split(os.environ.get('LDFLAGS', ''))
|
||||
|
||||
cflags.append('-pthread')
|
||||
cflags.append('-DPRIMARY_VERSION={}'.format(version[0]))
|
||||
cflags.append('-DSECONDARY_VERSION={}'.format(version[1]))
|
||||
if not is_travis and not isosx and subprocess.Popen(
|
||||
[PKGCONFIG, 'glew', '--atleast-version=2']
|
||||
).wait() != 0:
|
||||
@@ -230,11 +239,13 @@ def option_parser():
|
||||
help='Build extension modules with debugging symbols'
|
||||
)
|
||||
p.add_argument(
|
||||
'--asan',
|
||||
'--sanitize',
|
||||
default=False,
|
||||
action='store_true',
|
||||
help='Turn on address sanitization to detect memory access errors. Note that if you do turn it on,'
|
||||
' you have to run kitty with the environment variable LD_PRELOAD=/usr/lib/libasan.so'
|
||||
help='Turn on sanitization to detect memory access errors and undefined behavior. Note that if you do turn it on,'
|
||||
' a special executable will be built for running the test suite. If you want to run normal kitty'
|
||||
' with sanitization, use LD_PRELOAD=libasan.so (for gcc) and'
|
||||
' LD_PRELOAD=/usr/lib/clang/4.0.0/lib/linux/libclang_rt.asan-x86_64.so (for clang, changing path as appropriate).'
|
||||
)
|
||||
p.add_argument(
|
||||
'--prefix',
|
||||
@@ -268,7 +279,7 @@ def find_c_files():
|
||||
|
||||
|
||||
def build(args, native_optimizations=True):
|
||||
init_env(args.debug, args.asan, native_optimizations)
|
||||
init_env(args.debug, args.sanitize, native_optimizations)
|
||||
compile_c_extension(
|
||||
'kitty/fast_data_types', args.incremental, *find_c_files()
|
||||
)
|
||||
@@ -281,6 +292,18 @@ def safe_makedirs(path):
|
||||
pass
|
||||
|
||||
|
||||
def build_test_launcher(args):
|
||||
cc, ccver = cc_version()
|
||||
cflags = '-g -Wall -Werror -fpie'.split()
|
||||
pylib = get_python_flags(cflags)
|
||||
sanitize_lib = (['-lasan'] if cc == 'gcc' else []) if args.sanitize else []
|
||||
cflags.extend(get_sanitize_args(cc, ccver) if args.sanitize else [])
|
||||
cmd = [cc] + cflags + [
|
||||
'test-launcher.c', '-o', 'test-launcher',
|
||||
] + sanitize_lib + pylib
|
||||
run_tool(cmd)
|
||||
|
||||
|
||||
def package(args, for_bundle=False): # {{{
|
||||
ddir = args.prefix
|
||||
libdir = os.path.join(ddir, 'lib', 'kitty')
|
||||
@@ -360,6 +383,7 @@ def main():
|
||||
os.chdir(os.path.dirname(os.path.abspath(__file__)))
|
||||
if args.action == 'build':
|
||||
build(args)
|
||||
build_test_launcher(args)
|
||||
elif args.action == 'test':
|
||||
os.execlp(
|
||||
sys.executable, sys.executable, os.path.join(base, 'test.py')
|
||||
|
||||
13
test-launcher.c
Normal file
13
test-launcher.c
Normal file
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* linux-launcher.c
|
||||
* Copyright (C) 2017 Kovid Goyal <kovid at kovidgoyal.net>
|
||||
*
|
||||
* Distributed under terms of the GPL3 license.
|
||||
*/
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
wchar_t *wargv[2] = {L"kitty-test", L"test.py"};
|
||||
return Py_Main(2, wargv);
|
||||
}
|
||||
Reference in New Issue
Block a user