mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-06 08:01:58 +02:00
Fix vertical_align serialization
This commit is contained in:
@@ -274,14 +274,18 @@ def multicell_command(payload: str) -> None:
|
||||
c = json.loads(payload)
|
||||
text = c.pop('', '')
|
||||
m = ''
|
||||
if (w := c.get('width')) is not None and w > 0:
|
||||
if (w := c.pop('width', None)) is not None and w > 0:
|
||||
m += f'w={w}:'
|
||||
if (s := c.get('scale')) is not None and s > 1:
|
||||
if (s := c.pop('scale', None)) is not None and s > 1:
|
||||
m += f's={s}:'
|
||||
if (n := c.get('subscale_n')) is not None and n > 0:
|
||||
if (n := c.pop('subscale_n', None)) is not None and n > 0:
|
||||
m += f'n={n}:'
|
||||
if (d := c.get('subscale_d')) is not None and d > 0:
|
||||
if (d := c.pop('subscale_d', None)) is not None and d > 0:
|
||||
m += f'd={d}:'
|
||||
if (v := c.pop('vertical_align', None)) is not None and v > 0:
|
||||
m += f'v={v}:'
|
||||
if c:
|
||||
raise Exception('Unknown keys in multicell_command: ' + ', '.join(c))
|
||||
write(f'{OSC}{TEXT_SIZE_CODE};{m.rstrip(":")};{text}\a')
|
||||
|
||||
|
||||
|
||||
@@ -78,6 +78,9 @@ write_multicell_ansi_prefix(ANSILineState *s, const CPUCell *mcd) {
|
||||
if (mcd->subscale_d) {
|
||||
w('d'); w('='); nonnegative_integer_as_utf32(mcd->subscale_d, s->output_buf); w(':');
|
||||
}
|
||||
if (mcd->vertical_align) {
|
||||
w('v'); w('='); nonnegative_integer_as_utf32(mcd->vertical_align, s->output_buf); w(':');
|
||||
}
|
||||
if (s->output_buf->buf[s->output_buf->len - 1] == ':') s->output_buf->len--;
|
||||
w(';');
|
||||
#undef w
|
||||
|
||||
@@ -400,7 +400,7 @@ def test_multicell(self: TestMulticell) -> None:
|
||||
|
||||
s.reset()
|
||||
multicell(s, 'a', width=2, scale=3, subscale_n=1, subscale_d=2, vertical_align=1)
|
||||
ta('\x1b]66;w=2:s=3:n=1:d=2;a\x07')
|
||||
ta('\x1b]66;w=2:s=3:n=1:d=2:v=1;a\x07')
|
||||
s.draw('a')
|
||||
multicell(s, 'b', width=2)
|
||||
s.draw('c')
|
||||
|
||||
Reference in New Issue
Block a user