- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 5
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
Display corruption in panels after window shrink #2684
Comments
The function select_item() is the one that fixes the layout to make sure that the selected file is scrolled to be within the viewport. However, this function is not called on resize.
Please see the attached patch. (Of course, there are multiple possible places to place this call, you might prefer a different location.) |
|
Side note: Similar bug happens when the window size is not changed, but you change an mc option that alters the panel size, e.g. you enable the hint bar. My patch happens to fix this particular case too, but I'm not sure it fixes all the cases. Probably it's not that important though :) |
A much better version |
I attach a much better version.
The problem was not that the infrastructure wasn't there, it was mainly some code duplication between adjust_top_file (buggy implementation) and select_item (correct implementation).
The bugs in the probably legacy adjust_top_file, which was executed at resize, are:
I've slightly refactored the code by moving the correct implementation to adjust_top_file. I've also refactored this good implementation a little bit and added comment to hopefully make it clearer what's going on.
Please review and apply if looks good, thanks! I hope it can make it into the next stable (4.8.1.1); after all, a display corruption on the main screen is quite ugly. |
branch: 2684_always_show_selected_file
Please review |
Purely as a coding excercise for fun, I created an alternate version "try3". It is equally good as "try2". Pick whichever you personally prefer :)
I made some manual optimization in adjust_top_file for the code to be shorter, in the expense of probably being a tiny little bit harder to understand (but I explained it in the comment), more like in traditional "hackish" style.
The story is: in the big branch of adjust_top_file (in try2), if you reshuffle the four checks to a particular order, then there's no need for the other branch as now the big branch happens to return the desired value in that case too. |
Alternate version, equally good as try2 |
ARGH! :) |
:D
(Feel free to ignore try3 :)) |
|
|
Can I has backport to 4.8.1.x pretty please? :)
Soon that's going to be the stable branch for a year or even more, it'd be nice not to leave it with display corruption on the main screen.
Thanks a lot! |
Important
This issue was migrated from Trac:
egmont
(@egmontkob)Scenario 1:
Scenario 2:
Scenario 3, 4, etc.: Place the cursor on the 3rd (4th, etc.) visible file from the bottom, and shrink by 3 (4, etc. respectively) lines in one step. Actual behavior: as in scenario 2.
Note
Original attachments:
egmont
(@egmontkob) onDec 5, 2011 at 16:54 UTC
egmont
(@egmontkob) onJan 18, 2012 at 12:18 UTC
egmont
(@egmontkob) onJan 19, 2012 at 9:08 UTC
The text was updated successfully, but these errors were encountered: