-
-
Notifications
You must be signed in to change notification settings - Fork 61
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
Vertical shrinking of screen beyond a limit causes app to crash #23
Comments
Hey! I have interest in doing this one too if it's okay :) |
Hi @gudeliauskaspam 👋🏼 Thank you for your interest in contributing! 🎉 |
hey @Mithil467 , sorry for the lack of news, I will start working on this problem next week :) |
as far as i could understand the problem and the code in initialize method, a solution would be to count how many characters or maybe words fit in the box vertically. |
Have a look at this line, this is what is being done once at the start of the program. Line 157 in 10792fc
So at the start, we already are checking if window size if enough to print the text. Similarly, we will need a check inside resize function. Line 387 in 10792fc
|
sorry I got it wrong, thanks for clarifying! |
I fixed this problem and new ones appeared. |
No issues. Just make sure you are on the latest code on master before working! |
hey, @Mithil467. I need your help. self.text_height = word_wrap(self.original_text_formatted, self.window_height)
if self.window_height < len(self.text_height) + 3:
curses.endwin()
sys.stdout.write("Window too small to print given text")
sys.exit(1) When I increase or decrease the size of the terminal, it says "Window too small to print given text". |
The issue here is, you are comparing it with len(text) but that returns the length of the string and not the vertical height of the window required. Currently there exists a check here - Line 154 in d3f756a
We have to do something similar in the resize function here - Line 409 in d3f756a
|
Finally done :) |
Thank you so much for the fix! @gudeliauskaspam 😄 |
Steps to reproduce
Start mitype. Reduce the size of the terminal vertically. It will crash after a certain point where screen becomes smaller than what is required to print the text.
Expected behaviour
Mitype should:
Actual behaviour
Crashes with traceback -
Your proposed fix
We have implemented a size check in the
initialize
method in app.py already which warns the user that the terminal is smaller than the amount of lines required. We can use a similar check inresize
method.The text was updated successfully, but these errors were encountered: