Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ui3o opened this issue Mar 15, 2022 · 8 comments
Closed

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

ui3o opened this issue Mar 15, 2022 · 8 comments
Labels

Comments

@ui3o
Copy link

ui3o commented Mar 15, 2022

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.

@ui3o ui3o added the bug label Mar 15, 2022
@kovidgoyal
Copy link
Owner

No. You need to output an explicit newline if you want there to be a
line break. Otherwise lines that are wrapped because of size are
combined. This is by design and is not going to change.

@ui3o
Copy link
Author

ui3o commented Mar 16, 2022

No. console.log(); makes an explicit line break. But I modified the code to process.stdout.write('\n'); and it is the same.

If you run the sample code, and do not resize the window you can see after program exit if you make the size bigger second line always stay on the second place which is good!

If test with the reproduce description you can see the issue.

I made a new screenshot about the compare.

kitty.mp4

@kovidgoyal
Copy link
Owner

Now fixed.

@ui3o
Copy link
Author

ui3o commented Mar 16, 2022

Thank you for a quick fix! Are you going to make a new release?

@kovidgoyal
Copy link
Owner

Not anytime soon, no. You can use the kitty nightly builds if you wish
in the meantime.

@ui3o
Copy link
Author

ui3o commented Mar 16, 2022

When you trigger nightly builds?

@kovidgoyal
Copy link
Owner

@ui3o
Copy link
Author

ui3o commented Mar 22, 2022

I tested it, and now it is fixed! Thank for it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants