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

Resizing terminal window causes error #8

Open
datagod opened this issue Oct 16, 2021 · 0 comments
Open

Resizing terminal window causes error #8

datagod opened this issue Oct 16, 2021 · 0 comments

Comments

@datagod
Copy link
Owner

datagod commented Oct 16, 2021

Describe the bug

Users reported that while running in a terminal window N and I functions result in error:

ERROR - Function ( Clear ) has encountered an error.
prefresh() returned ERR

TRACE
Traceback (most recent call last):
File "./meshwatch.py", line 430, in Clear
self.TextPad.refresh(0,0,self.y1,self.x1,self.y1 + self.rows,self.x1 + self.columns)
_curses.error: prefresh() returned ERR

Additonal info: erasing textpad

Note from another user regarding curses:
ksamson
2d
For those having stability issues, I happened to trip over this:
curses — Terminal handling for character-cell displays — Python 3.10.0 documentation 2
A bug in ncurses, the backend for this Python module, can cause SegFaults when resizing windows. This is fixed in ncurses-6.1-20190511. If you are stuck with an earlier ncurses, you can avoid triggering this if you do not call addstr() with a str that has embedded newlines. Instead, call addstr() separately for each line.

michaellass added a commit to michaellass/meshwatch that referenced this issue Jun 21, 2022
If the screen has too few lines or columns to display all of the windows
entirely, TextPad.refresh will crash with the following error:

Traceback (most recent call last):
  File "meshtastic/meshwatch/meshwatch.py", line 431, in Clear
    self.TextPad.refresh(0,0,self.y1,self.x1,self.y1 + self.rows,self.x1 + self.columns)
_curses.error: prefresh() returned ERR

A nice solution would be to rescale the windows according to the screen
size but as a first measure, quit gracefully instead of crashing. This
change does not protect against users shrinking their console or
increasing font size after startup
(cf. datagod#8)

Fixes datagod#11
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

1 participant