Skip to content

[input-] handle resizes during input or cell edit #2823

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
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

midichef
Copy link
Contributor

In the middle of edit-cell or exec-longname, if you resize the terminal pushing the current cell offscreen, you get a curses error:

    File "/home/midichef/.venv/lib/python3.12/site-packages/visidata/_input.py", line 396, in editText
        v = widget.editline(vd.activeSheet._scr, y, x, w, attr=attr, updater=updater, bindings=bindings, clear=clear)
...
    File "/home/midichef/.venv/lib/python3.12/site-packages/visidata/_input.py", line 581, in _drawPrompt
        clipdraw(sheet._scr, y, 0, prompt, attr, w=sheet.windowWidth-rstatuslen-1)
...
    File "/home/midichef/.venv/lib/python3.12/site-packages/visidata/cliptext.py", line 242, in clipdraw_chunks
        scr.addstr(y, x, disp_column_fill*actualw, cattr.attr)  # clear whole area before displaying
    _curses.error: addwstr() returned ERR

This PR catches the error gracefully.

It was hard to connect this error to the resize event, because the stack trace would go to the terminal, and only be noticed much later on exiting visidata.

@midichef
Copy link
Contributor Author

The test here did not really fail, it's the timeout trying to fetch http://visidata.org/usage.tsv that keeps happening, this time it had this error:
cannot open URL: [SSL: UNEXPECTED_EOF_WHILE_READING] EOF occurred in violation of protocol (_ssl.c:1010)

@midichef
Copy link
Contributor Author

For testing, the most consistent way I have found to trigger the curses error (for gnome-terminal on Ubuntu) is: press Space to run exec-longname and then increase the font size with Ctrl+Shift+= aka Ctrl +

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

Successfully merging this pull request may close these issues.

1 participant