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 is handled poorly #67

Open
mikebolt opened this issue Mar 13, 2014 · 1 comment
Open

Resizing is handled poorly #67

mikebolt opened this issue Mar 13, 2014 · 1 comment

Comments

@mikebolt
Copy link
Contributor

Whenever my terminal is resized with cReddit already running, the position of the text on the screen does not change at all. If the terminal window is made wider, empty space is added to the right side. Similarly if the terminal window is made narrower, then whatever was on the screen is clipped.

Once a key is pressed that changes something on screen, only the link section at the bottom of the terminal is "aware" of the resizing and starts using the new amount of space to display text.

This is strange behavior. ncurses should be able to know when a terminal is resized, because programs like vim can. cReddit should know when the window is resized and immediately redraw the text with the right display width and formatting.

@mkilgore
Copy link
Contributor

I agree it's an issue, I've got some other changes in the works and I might take a stab at this one.

It shouldn't that hard to do. We render the lines into separate buffers in the LinkScreen and CommentScreen structs, and then print those buffers to the screen when that line is on the screen and something changes. When a new line shows up (Such as if you scroll past the bottom and cause a new link to appear), only that new line is rendered, all the old lines keep their old rendering. All we'd really have to do is keep asking ncurses if the screen size changed, and then free and erase all of the lines on the current screen. Then the next time the screen is printed (Which should be forced at that point), add a check to see if the line is NULL in the 'drawScreen' section, and then render the line again if it is.

This is pretty simple - I don't know when I'll be able to do this, but it's a change that probably wouldn't take more then 5/10 minutes really. If someone else tries this, just make sure that you update the code for both the LinkScreen and CommentScreen.

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

2 participants