Skip to content

exits 255 when resized to height=1 #2740

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

Open
tyamakawatt opened this issue Apr 28, 2025 · 2 comments · May be fixed by #2741
Open

exits 255 when resized to height=1 #2740

tyamakawatt opened this issue Apr 28, 2025 · 2 comments · May be fixed by #2741
Labels

Comments

@tyamakawatt
Copy link
Contributor

Small description

When the terminal VisiData is running in is resized to a height of 1, it immediately exits with a code of 255.

Steps to reproduce

  1. Run vd
  2. Resize height of terminal window to 1

Expected result

VisiData shouldn't crash and when the terminal is resized to its original size it should continue running just like other programs likes less or top or nvim.

Actual result with screenshot

(nothing interesting here, no error messages are printed or anything)

Configuration

  • Does this issue reproduce without any plugins or configuration (using the -N CLI flag)?

Yes.

I am using version saul.pw/VisiData v3.1.1

Additional context

  • What platform and version are you using (Linux, MacOS, Windows)?

Linux and MacOS.

  • Which version of Python?

3.10.12

  • Which terminal are you using (for display and input issues)?

iTerm2 with tmux running in it. I constantly resize tmux panes down to a height of 1 and then restore the size.

@midichef
Copy link
Contributor

midichef commented Apr 28, 2025

Thanks for catching this case. When visidata exits silently from a caught exception, you can see the exception by running with debug mode turned on: vd --debug.

In this case, with tmux with a pane of height 1, I see exceptions from trying to make subwindows with height < 0 or y > height:

  File "/home/midichef/.local/lib/python3.10/site-packages/visidata/basesheet.py", line 313, in redraw
    vd.setWindows(vd.scrFull)
  File "/home/midichef/.local/lib/python3.10/site-packages/visidata/mainloop.py", line 84, in setWindows
    vd.winTop = vd.subwindow(scr, 0, topmenulines, w, n)
  File "/home/midichef/.local/lib/python3.10/site-packages/visidata/tuiwin.py", line 9, in subwindow
    newscr = scr.derwin(h, w, y, x)
_curses.error: curses function returned NULL

I'll submit a PR that puts range restrictions on the coordinates and dimensions.

(Incidentally, debug mode is inappropriate for everyday use as it can shut vd down at the first exception, even when you might prefer vd to continue.)

@tyamakawatt
Copy link
Contributor Author

Thanks, I didn't know about vd --debug. I updated the template: #2742

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

Successfully merging a pull request may close this issue.

2 participants