applejag / kubectl-klock

A kubectl plugin to render watch output in a more readable fashion
GNU General Public License v3.0
29 stars 2 forks source link

Toggling full screen in terminal deletes the line above #93

Open semihbkgr opened 4 months ago

semihbkgr commented 4 months ago

Switching from full screen to normal mode deletes the previous lines in the terminal.

applejag commented 4 months ago

I don't believe I've gotten this behavior on alacritty. What terminal emulator are you using?

And do you mean just toggling it on and off? Like running kubectl klock pods followed by tapping f twice?

semihbkgr commented 4 months ago

I am using iTerm terminal emulator with tmux and zsh shell.

And do you mean just toggling it on and off? Like running kubectl klock pods followed by tapping f twice?

Yes I meant that.

applejag commented 4 months ago

Ah yes now I'm able to reproduce it. Didn't really see the issue at first. It only deletes a single line. Super strange!

I wonder if it's because the output doesn't have a trailing newline, and that somehow messes it up? :thinking:

applejag commented 4 months ago

Found the reason. When toggling fullscreen the status bar of "force fullscreen" appears, changing the number of lines in the output.

Charmbracelet seems to get confused when changing the number of output lines is done in the middle of switching fullscreen mode.

It seems to think it's still showing 3 lines when exiting fullscreen mode, so it clears the last 3 lines to make room for the output. But then there's only 2 lines of output as the status line disappeared, which causes this visual bug.

applejag commented 4 months ago

I created a small repro to verify that it's bubbletea library that's causing it, and it seems to be that way.

We could maybe work around it in klock with some hacks, but to begin with I've created an issue on bubbletea's repo. Let's see if we can get help from the charmbracelet team to get it fixed upstream instead: https://github.com/charmbracelet/bubbletea/issues/1013