mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-11-21 15:44:44 +00:00
Merge branch 'codex/fix-ilp32-special-color-decoding' of https://github.com/hezhizhen/kitty
This commit is contained in:
commit
4c701fcaa2
2 changed files with 34 additions and 18 deletions
|
|
@ -1681,29 +1681,31 @@ PYWRAP1(patch_global_colors) {
|
|||
PyObject *spec;
|
||||
int configured;
|
||||
if (!PyArg_ParseTuple(args, "Op", &spec, &configured)) return NULL;
|
||||
#define P(name) \
|
||||
{ \
|
||||
PyObject *val = PyDict_GetItemString(spec, #name); \
|
||||
if (val) { \
|
||||
if (val == Py_None) OPT(name) = 0; \
|
||||
else if (PyLong_Check(val)) OPT(name) = PyLong_AsLong(val); \
|
||||
} \
|
||||
#define P(name, convert) \
|
||||
{ \
|
||||
PyObject *val = PyDict_GetItemString(spec, #name); \
|
||||
if (val) { \
|
||||
if (val == Py_None) OPT(name) = 0; \
|
||||
else if (PyLong_Check(val)) OPT(name) = convert(val); \
|
||||
} \
|
||||
}
|
||||
P(active_border_color);
|
||||
P(inactive_border_color);
|
||||
P(bell_border_color);
|
||||
P(tab_bar_background);
|
||||
P(tab_bar_margin_color);
|
||||
P(macos_titlebar_color);
|
||||
P(wayland_titlebar_color);
|
||||
P(scrollbar_handle_color);
|
||||
P(scrollbar_track_color);
|
||||
P(active_border_color, PyLong_AsLong);
|
||||
P(inactive_border_color, PyLong_AsLong);
|
||||
P(bell_border_color, PyLong_AsLong);
|
||||
P(tab_bar_background, PyLong_AsLong);
|
||||
P(tab_bar_margin_color, PyLong_AsLong);
|
||||
P(macos_titlebar_color, PyLong_AsLong);
|
||||
// The RGB payload of these options can set bit 31.
|
||||
P(wayland_titlebar_color, PyLong_AsUnsignedLong);
|
||||
P(scrollbar_handle_color, PyLong_AsUnsignedLong);
|
||||
P(scrollbar_track_color, PyLong_AsUnsignedLong);
|
||||
if (configured) {
|
||||
P(background);
|
||||
P(background, PyLong_AsLong);
|
||||
const color_type prev_url_color = OPT(url_color);
|
||||
P(url_color);
|
||||
P(url_color, PyLong_AsLong);
|
||||
if (OPT(url_color) != prev_url_color) mark_all_color_profiles_dirty();
|
||||
}
|
||||
#undef P
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,6 +38,20 @@ class TestConfParsing(BaseTest):
|
|||
def test_font_size_clamping(self):
|
||||
font_size_clamping(self)
|
||||
|
||||
def test_patch_global_special_colors(self):
|
||||
from kitty.fast_data_types import patch_global_colors
|
||||
|
||||
self.set_options()
|
||||
for name, value in (
|
||||
('wayland_titlebar_color', 0x80000002),
|
||||
('scrollbar_handle_color', 0xFF000002),
|
||||
('scrollbar_track_color', 0xFFFFFF02),
|
||||
('macos_titlebar_color', -1),
|
||||
('macos_titlebar_color', -2),
|
||||
):
|
||||
with self.subTest(name=name, value=value):
|
||||
patch_global_colors({name: value}, False)
|
||||
|
||||
def test_session_launch_option_expansion(self) -> None:
|
||||
from kitty.launch import LaunchSpec
|
||||
from kitty.options.types import defaults
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue