Allow 16 entries on the pointer shape stack

This commit is contained in:
rudolf-blue 2026-10-08 22:30:24 -04:00
parent d2a272bb98
commit f16d09603e
2 changed files with 24 additions and 1 deletions

View file

@ -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 {

View file

@ -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'),