diff --git a/kitty/line.h b/kitty/line.h index a5cece6e8..169b5c6f9 100644 --- a/kitty/line.h +++ b/kitty/line.h @@ -43,6 +43,7 @@ static_assert(sizeof(GPUCell) == 20, "Fix the ordering of GPUCell"); #define SCALE_BITS 3 #define WIDTH_BITS 3 #define SUBSCALE_BITS 4 +#define VALIGN_BITS 2 typedef union CPUCell { struct { @@ -55,12 +56,12 @@ typedef union CPUCell { char_type scale: SCALE_BITS; char_type subscale_n: SUBSCALE_BITS; char_type subscale_d: SUBSCALE_BITS; - char_type x : WIDTH_BITS + SCALE_BITS + 1; - char_type y : SCALE_BITS + 1; + char_type x : WIDTH_BITS + SCALE_BITS; + char_type y : SCALE_BITS; char_type width: WIDTH_BITS; - char_type vertical_align: 3; + char_type vertical_align: VALIGN_BITS; char_type temp_flag: 1; - char_type : 14; + char_type : 17; }; struct { char_type ch_and_idx: sizeof(char_type) * 8; diff --git a/kitty/screen.c b/kitty/screen.c index 3246bd2e3..43f81c056 100644 --- a/kitty/screen.c +++ b/kitty/screen.c @@ -1258,7 +1258,7 @@ screen_handle_multicell_command(Screen *self, const MultiCellCommand *cmd, const CPUCell mcd = { .width=MIN(cmd->width, M(WIDTH_BITS)), .scale=MAX(1u, MIN(cmd->scale, M(SCALE_BITS))), .subscale_n=MIN(cmd->subscale_n, M(SUBSCALE_BITS)), .subscale_d=MIN(cmd->subscale_d, M(SUBSCALE_BITS)), - .vertical_align=MIN(cmd->vertical_align, 7u), .is_multicell=true + .vertical_align=MIN(cmd->vertical_align, M(VALIGN_BITS)), .is_multicell=true }; #undef M if (mcd.width) handle_fixed_width_multicell_command(self, mcd, self->lc); diff --git a/kitty_tests/multicell.py b/kitty_tests/multicell.py index afccb0846..104728290 100644 --- a/kitty_tests/multicell.py +++ b/kitty_tests/multicell.py @@ -129,9 +129,14 @@ def test_multicell(self: TestMulticell) -> None: for x in range(1, 3): comb(x, y) comb(0, 1) + s = self.create_screen(cols=7 * 7, lines=7) + multicell(s, 'a', scale=7, width=7) + for y in range(s.lines): + for x in range(s.columns): + ac(x, y, is_multicell=True, x=x, y=y) # Test wrapping - s.reset() + s = self.create_screen(cols=6, lines=6) s.draw('x' * (s.columns - 1)) multicell(s, 'a', scale=2) ac(s.columns - 1, 0, is_multicell=False, text='', next_char_was_wrapped=True)