From f16d09603e2ed03caced8cef85e2943da2766714 Mon Sep 17 00:00:00 2001 From: rudolf-blue Date: Thu, 8 Oct 2026 22:30:24 -0400 Subject: [PATCH] Allow 16 entries on the pointer shape stack --- kitty/screen.c | 5 ++++- kitty_tests/screen.py | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/kitty/screen.c b/kitty/screen.c index 882d600b6..5d78b4f28 100644 --- a/kitty/screen.c +++ b/kitty/screen.c @@ -2220,12 +2220,15 @@ change_pointer_shape(Screen *self, PyObject *args) { if (!PyArg_ParseTuple(args, "ss", &b, &css_name)) return NULL; op = b[0]; uint8_t *count, *stack; + size_t stack_sz; if (self->main_linebuf == self->linebuf) { count = &self->main_pointer_shape_stack.count; stack = self->main_pointer_shape_stack.stack; + stack_sz = arraysz(self->main_pointer_shape_stack.stack); } else { count = &self->alternate_pointer_shape_stack.count; stack = self->alternate_pointer_shape_stack.stack; + stack_sz = arraysz(self->alternate_pointer_shape_stack.stack); } if (op == '<') { if (*count) *count -= 1; @@ -2318,7 +2321,7 @@ change_pointer_shape(Screen *self, PyObject *args) { if (!*count) *count += 1; stack[*count - 1] = s; } else if (op == '>') { - if ((*count + 1u) >= arraysz(self->main_pointer_shape_stack.stack)) { remove_i_from_array(stack, 0, *count); } + if (*count >= stack_sz) { remove_i_from_array(stack, 0, *count); } *count += 1; stack[*count - 1] = s; } else { diff --git a/kitty_tests/screen.py b/kitty_tests/screen.py index ce9176170..6145af01f 100644 --- a/kitty_tests/screen.py +++ b/kitty_tests/screen.py @@ -2129,6 +2129,26 @@ class TestScreen(BaseTest): t('=left_ptr', 'default') t('=fleur', 'move') + names = 'alias cell copy crosshair help move wait text pointer progress zoom-in zoom-out e-resize n-resize s-resize w-resize'.split() + for which_screen in (0, 1): + s.reset() + if which_screen: + s.toggle_alt_screen() + for n in names: + s.change_pointer_shape('>', n) + for n in reversed(names): + self.ae(send('?__current__'), n) + s.change_pointer_shape('<', '') + self.ae(send('?__current__'), '0') + for n in names + ['ne-resize']: + s.change_pointer_shape('>', n) + for n in reversed(names[1:] + ['ne-resize']): + self.ae(send('?__current__'), n) + s.change_pointer_shape('<', '') + self.ae(send('?__current__'), '0') + if which_screen: + s.toggle_alt_screen() + def test_decoration_sgr_round_trip(self): for code, extra, expected in ( (1, '', '4'), (2, '', '4:2'), (3, '', '4:3'), (4, '', '4:4'), (5, '', '4:5'),