Skip to content

kitty skip new line character ('\n') after resize #4837

Description

@ui3o

Describe the bug
I have a program which refresh a cli menu after terminal resize. When the terminal going to have a smaller size and the menu will be refreshed the lines will be printed.
BUG: After make the terminal size bigger the line delimiter will be ignored by kitty and the last line will be joined to the previous line.

To Reproduce
Run this nodejs program:

// for test running  
setTimeout(() => { process.exit(); }, 15000);

process.stdout.on('resize', async () => {
  process.stdout.write('\x1b[3F');
  await test();
  process.exit();
});

const line = async (long = false) => {
  if (long) process.stdout.write('      ' + 'a'.repeat(process.stdout.columns - 6 - 2) + `\x1b[K`);
  if (!long) process.stdout.write('      ' + 'b'.repeat(6) + `\x1b[K`);
  process.stdout.write('\n');
}

const test = async () => {
  await line(true);
  await line();
  process.stdout.write(`\x1b[0J`);
}
test();

Steps to reproduce the behavior:

  1. run the nodejs program above
  2. resize the terminal a little bit smaller
  3. after the program exit resize the terminal to a little bit bigger and see the joined lines

Screenshots

  1. On top left there is a kitty terminal
  2. On bottom left here is an alacritty terminal
  3. After the program exit, when the terminal was resized back the kitty terminal join the last line to the previous line. This cause the problem, because not possible to calculate how many lines was printed. If the second line is short this going the be one line!! The line delimiter always need to be line delimiter.
kittyVSalacritty.mp4

Environment details

kitty 0.24.2 created by Kovid Goyal
Linux xyz-lp 5.13.19-2-MANJARO #1 SMP PREEMPT Sun Sep 19 21:31:53 UTC 2021 x86_64
Manjaro Linux 5.13.19-2-MANJARO  (xyz-lp) (/dev/tty)


DISTRIB_ID=ManjaroLinux
DISTRIB_RELEASE=21.2.4
DISTRIB_CODENAME=Qonos
DISTRIB_DESCRIPTION="Manjaro Linux"
Running under: X11
Frozen: False
Paths:
  kitty: /usr/bin/kitty
  base dir: /usr/lib/kitty
  extensions dir: /usr/lib/kitty/kitty
  system shell: /bin/zsh

Additional context
Possible to reproduce with kitty --config NONE.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions