Skip to content

Scrollback buffer corruption when resizing and font: misplaced newline #7033

@adamdicarlo

Description

@adamdicarlo

Describe the bug

A scrollback line is broken (line-broken) several characters too soon, somewhere in the process of:

  • Increasing font size, causing some lines to scroll off the top
  • Restoring font size

To Reproduce

kitty --config NONE -o allow_remote_control=y bash -c '
  sleep 1
  cols=$(tput cols)
  rows=$(tput lines)
  for (( y = 0 ; y < $rows; y++ )); do
    printf "["
    for (( x = 2; x < $cols; x++ )); do
      if (( y % 2 == 0 )); then
        printf "="
      else
        printf "."
      fi
    done
    printf "]"
  done
  sleep 0.5
  kitty @ set-font-size +1
  kitty @ set-font-size -- -1
  kitty @ scroll-window start
  read
'

(I got the idea to write this from the repro script in #2619 👍🏼 )

You may not need the leading sleep 1 in the script. I seemed to need it to allow Sway time enough to get the new window into its final size.

I experimented with the rows setting in the script and found interesting things. For instance:

  # The errantly inserted line break occurs one line before it does normally
  rows=$(( $(tput lines) - 1 ))

  # No bug happens -- I guess there are not enough lines for output to scroll
  # off the top of the viewport?
  rows=$(( $(tput lines) / 2 ))

P.S. Thank you for kitty! I've been using it for several years, and I ❤️ it! :)

Screenshots

20240120-192133-screen

Environment details

Press Ctrl+Shift+F6 [...]

This didn't work for me; I just got the message below. I'm on a fairly crusty Arch system that's been installed for about four years, so maybe something is misconfigured due to too much experimentation over the years. I can reproduce and post debug info from my work machine, too, though, if that's helpful!

Failed to launch child: usr/bin/less
With error: No such file or directory
Press Enter or Esc to exit

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions