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

Buffer's text is gone after spawning a new window in swaywm #24272

Closed
kohane27 opened this issue Jul 6, 2023 · 7 comments
Closed

Buffer's text is gone after spawning a new window in swaywm #24272

kohane27 opened this issue Jul 6, 2023 · 7 comments

Comments

@kohane27
Copy link
Sponsor

kohane27 commented Jul 6, 2023

Problem

Hello there. Hope you're doing well. Thank you for checking out this bug issue of mine. I appreciate it.

A picture is worth a thousand words so please see the following video:

cute-WHGMy_2.mp4
  1. kitty is opened on workspace 1
  2. I spawned a new terminal next to it
  3. All the text in the nvim window is gone. But when I scroll, it re-appears
  4. The Enter key is not responding, i.e., pressing Enter has no effect
  5. I had to kill the terminal

Another video showing the key Enter has no response. The terminal is foot, showing it's not the terminal issue:

cute-ppgzw_2.mp4

What I Have Tried

  1. Open nvim in a terminal without tmux, but the same issue persists
  2. Likely similar or same issue mentioned in Weird graphic glitch on small terminals #24239 because the command :resize fixed it (the Enter key doesn't work but C-j (acts as Enter in the terminal) works)
  3. My main terminal is kitty. I tried other GPU-accelerated terminals like WezTerm and Alacritty. They all have the same issue. I thought it's the GPU aspect of it, so I also tried non-GPU-accelerated terminals like foot and UXTerm. They also have the same issue.
:version
NVIM v0.9.1
Build type: Release
LuaJIT 2.1.0-beta3

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"

System info:

Kernel: Linux 6.1.37-1-lts
WM: sway
CPU: AMD Ryzen 7 PRO 5850U with Radeon Graphics (16) @ 1.900GHz
GPU: AMD ATI Radeon Vega Series / Radeon Vega Mobile Series

Any input is much appreciated. Thank you.

Steps to reproduce

please see above video description

Expected behavior

buffer's text is not gone and enter key works

Neovim version (nvim -v)

NVIM v0.9.1

Vim (not Nvim) behaves the same?

no, VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Jun 14 2023 00:27:53)

Operating system/version

Linux 6.1.37-1-lts

Terminal name/version

kitty 0.28.1

$TERM environment variable

tmux-256color

Installation

aur

@kohane27 kohane27 added the bug issues reporting wrong behavior label Jul 6, 2023
@kohane27 kohane27 changed the title Buffer's text are gone in the terminal after spawning a new window in swaywm Buffer's text is gone in the terminal after spawning a new window in swaywm Jul 6, 2023
@kohane27 kohane27 changed the title Buffer's text is gone in the terminal after spawning a new window in swaywm Buffer's text is gone after spawning a new window in swaywm Jul 6, 2023
@justinmk
Copy link
Member

justinmk commented Jul 6, 2023

Can you try the development version?

  • The Releases page has pre-built archives for Linux/Windows/macOS.
  • Check :version to confirm that you are using the latest version.

@justinmk justinmk added tui display redraw, layout, presentation labels Jul 6, 2023
@kohane27 kohane27 closed this as completed Jul 6, 2023
@kohane27 kohane27 reopened this Jul 6, 2023
@zeertzjq zeertzjq added needs:repro We need minimal steps to reproduce the issue ui and removed tui labels Jul 6, 2023
@kohane27
Copy link
Sponsor Author

kohane27 commented Jul 6, 2023

Hello @justinmk ! Thank you for such a quick reply! I appreciate it.

I installed through the aur neovim-git:

:version
NVIM v0.10.0-dev-638+g4e34ca8ae7
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3

Please see the video below:

cute-OGrHx_2.mp4

The issue doesn't immediately appear for the first spawn but it shows up on the second spawn of new terminal.

I'll provide a minimal config to see if the same issue exists.

Thank you again!

@kohane27
Copy link
Sponsor Author

kohane27 commented Jul 6, 2023

I tried the minimal config fzf-lua#quickstart and the issue is not showing up:

cute-mZDpj_2.mp4

I guess it's one of my plugins causing this issue. I'll investigate and provide further comment. Thank you!

@kohane27
Copy link
Sponsor Author

kohane27 commented Jul 7, 2023

I updated today with the version being NVIM v0.10.0-dev-641+g811140e276, and I'm very glad to report that this issue is gone!
I guess now I have to wait for this bugfix to be back ported to the stable version. Thank you again!

@kohane27 kohane27 closed this as completed Jul 7, 2023
@justinmk justinmk added this to the 0.10 milestone Jul 7, 2023
@kohane27 kohane27 reopened this Jul 7, 2023
@justinmk
Copy link
Member

justinmk commented Jul 7, 2023

?

@kohane27
Copy link
Sponsor Author

kohane27 commented Jul 7, 2023

@justinmk Please see the video:

cute-PAyCZ_2.mp4

Apologies for my mistake: I didn't test it thoroughly enough.

Some remarks:

  1. Enter key in the command mode doesn't work but it works in the Insert mode.
  2. Sometimes, spawning a new terminal inside the same tmux window can induce the same issue (so I guess not related to swaywm or even wayland?). So it seems like anything that resizes the nvim window may produce this issue.

After switching the nightly (currently on NVIM v0.10.0-dev-643+g804108af6c), this issue isn't reproducible definitely. I'll try to find a way to reliably reproduce this issue.

I'll not close the issue again until I'm sure it's fixed. Sorry again!

@zeertzjq zeertzjq removed this from the 0.10 milestone Jul 8, 2023
@kohane27
Copy link
Sponsor Author

kohane27 commented Jul 15, 2023

tl;dr: it's my zsh function causing the issue, not neovim.

It took me days to figure it out. It's not linux, sway, tmux, ranger, kitty, wezterm issue. The culprit is the following zsh function:

# very tenacious bug: causing terminal redraw issue
ranger_cd() {
    echo
    temp_file="$(mktemp -t "ranger_cd.XXXXXXXXXX")"
    ranger --choosedir="$temp_file" -- "${@:-$PWD}" <"$TTY"
    if chosen_dir="$(cat -- "$temp_file")" && [ -n "$chosen_dir" ] && [ "$chosen_dir" != "$PWD" ]; then
        cd -- "$chosen_dir" || exit
    fi
    zle reset-prompt
}

zle -N ranger_cd
bindkey '^F' ranger_cd

Whenever I use the above function to launch ranger to open neovim, the issue surfaces.

I've been using the above function for a long time, but suddenly it's causing this bug. I have no idea why. If, of the rare chance that someone is having the same problem as me, I'm now using the following substitute:

function r() {
  tempfile="$(mktemp -t tmp.XXXXXX)"

  ranger --choosedir="$tempfile" "${@:-$(pwd)}"

  test -f "$tempfile" && if [ "$(cat -- "$tempfile")" != "$(echo -n "$(pwd)")" ]; then
      cd -- "$(cat "$tempfile")" || return
    fi
}

bindkey -s "^F" "r\n"

Apologies for the trouble and noise. It's not neovim issue. I switched back to the stable release and the issue never re-surfaced after using the above function. Thanks guys!

@zeertzjq zeertzjq removed bug issues reporting wrong behavior ui needs:repro We need minimal steps to reproduce the issue display redraw, layout, presentation labels Jul 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants