ncspot icon indicating copy to clipboard operation
ncspot copied to clipboard

Screen Redraw Is Scoped To Initial Window Resolution

Open nbgibson opened this issue 2 years ago • 9 comments

Describe the bug This bug is partially in reference to #609. 'Ctrl + L' does well to resolve the "garbled text" issue seen when moving or resizing a window, but it redraws to the initial resolution of the terminal window when the program was started. Ideally the redraw call would poll for the existing window's dimensions and implement those rather than the cached value from initialization. This is observable in the current Windows build utilizing Powershell by way of the Windows Terminal. (I've also encountered similar issues at the time of launch of the program, but have been unable to reliably reproduce thus far.)

To Reproduce Steps to reproduce the behavior:

  1. Launch ncspot in the terminal emulator of your choice
  2. Resize the emulator to a different size
  3. Trigger the redraw command via 'Ctrl + L' hotkey command
  4. If the new size is smaller than the initial window resolution, there were be "overdraw" of ncspot. Should the new resolution be larger, ncspot will take up a portion up to but not beyond the initial resolution (anchored to the top left corner).

Expected behavior ncspot should resize to the current window's resolution at the time of the redraw command. Ideally this would be automatic, but one thing at a time.

Screenshots Default: image

Redrawing to a larger size: image

Redrawing to a smaller size: image

System (please complete the following information):

  • OS: Win10
  • Terminal: Windows Terminal (current)
  • Version: 0.9.5
  • Installed from: GitHub Release Page

Backtrace/Debug log Can provide if needed.

Additional context Comments on my music tastes are not solicited, but also not unwelcome. :v

nbgibson avatar Feb 07 '22 18:02 nbgibson

I can also reproduce this issue (has been present since a long time now).

rashil2000 avatar Feb 13 '22 16:02 rashil2000

Hmm, it could be a problem with pancurses/pdcurses not updating the screen size when the terminal is resized on Windows :thinking:

hrkfdn avatar Feb 13 '22 18:02 hrkfdn

Yeah, I think so. There was an issue upstream https://github.com/gyscos/cursive/issues/461, but it seems to be related to Linux.

rashil2000 avatar Feb 13 '22 18:02 rashil2000

Would it be possible to manually fetch the terminal dimensions when a user explicitly calls the resize event (i.e. through pressing Ctrl+L)?

rashil2000 avatar Feb 15 '22 07:02 rashil2000

Not easily, there is also no option to redraw for a specific screen size. I believe this needs to be fixed upstream.

hrkfdn avatar Feb 17 '22 19:02 hrkfdn

If I recall, building on Windows using cursive/crossterm-backend feature flag instead of cursive/pancurses-backend would allow the window to be resized.

Bettehem avatar Feb 17 '22 23:02 Bettehem

The cursive/crossterm-backend feature supports more stuff like mouse scrolling, bold/italic text and resizing as you said, but the huge disadvantage is the flicker - the entire screen redraws on each tiny change, making it unusable. Any way around that?

rashil2000 avatar Feb 18 '22 05:02 rashil2000

Not sure, I don't use Windows so I can't really help with that, sorry :/

Bettehem avatar Feb 19 '22 12:02 Bettehem

Jumping in to ask something that may be related - I also see that emoji/unicode characters are not drawn correctly in PowerShell (or in WSL via ncspot.exe): image

Although they are drawn correctly when installed in WSL and running the Ubuntu executable:

image

Should I open a new issue for this, or is it related ? Both screenshots are taken in Windows Terminal on Windows 11 22H2 (22621.2215)

bogdan-calapod avatar Sep 04 '23 19:09 bogdan-calapod