- 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
[mcview] Library/executable symbols not fully viewable #3817
Comments
Replying to lastique (#3817):
The exact criteria is 8K bytes. You can see that in the top-right corner as 8192/8192+. |
This behavior is not occured in text wrap mode.
I think the problem is in mcview_display_line (src/viewer/ascii.c:593) which is called in mcview_ascii_move_down (src/viewer/ascii.c:936). Probably, we should call mcview_may_still_grow() in ascii.c:593.
Egmont, do you have any idea? |
Will take a look soon, hopefully tonight. Thanks for looping me in! I could reproduce the problem. Do we know if it was my big rewrite that broke it? I'll check it.
I sometimes had a feeling that search was not reading the entire output, but, my bad, never cared enough to track down and file a bugreport. Could be caused by the same issue. |
It was indeed broken by me with the big viewer rewrite (#3250, bcb09f6). |
Trying to understand what's going on, to come up with the right fix:
mcview_display_line() contains two branches commented as "Optimization: Fast forward to the end of the line, rather than carefully parsing and then not actually displaying it."
This method does not only display the requested row of the screen, but also updates the state from where the next visible row can be painted. The state contains file offset, plus other attributes (e.g. nroff color) that we might need to carry.
In wrap mode, we need to stop right after displaying the visible row, there we have the state from where displaying the next visible row will continue. There's nothing else to do.
In nowrap mode, we need to skip to the end of the file's line. This is what the optimization branches do. This optimization could be cut off, in that case the "normal" body of the method would walk through the characters one by one, adjusting the state machine (e.g. tracking nroff changes etc.), just to drop this whole thing at the end (since no formatting state is carried across newlines).
A workaround for the current problem is to disable the ~10 lines of code at the top of this method commented as "Optimization....".
The core of the problem is that the "normal" path calls mcview_next_combining_char_sequence() which eventually uses mcview_get_byte() or mcview_get_utf() which take care of extending the growbuf if necessary. The shortcut optimized path calls mcview_eol() instead which does not. In fact, eventually it also calls mcview_get_byte(), however, beforehand it explicitly bails out if the end of the current buffer is reached, without trying to grow it.
Hence I'm wondering if the correct solution would be to fix mcview_eol() to grow if necessary.
This might fix some other weird corner cases as well. E.g. when the actual viewer area is only a single row high and you press Ctrl+E to get to the end of that line. (The bug here would be more prominent if Ctrl+E right-aligned the last visible row rather than the first. Then I guess we could spot a bug with sane window sizes as well.)
andrew_b, what do you think, does this approach sound reasonable to you? |
Replying to egmont:
Yes, it is reasonable for me, but I'm not so deeply in the viewer code. |
(Forget the paragraph about other bugs/corner cases, it was stupid.) |
Fix |
Could you guys please test this patch?
I haven't paid too much attention to possible side effects and haven't tested it thoroughly.
Also note that this patch does _not_ fix the search issue I've referred to, that seems to be a different bug. I've reported that as #3819. |
I patched the 4.8.18 that is shipped with my Ubuntu 17.04 and a quick test shows the problem is fixed. I'll keep using the patched version and see if there are any problems.
Thanks guys. |
Branch: 3817_mcview_grow_buffer
(I have some problem with correct commit comment.) |
|
|
Important
This issue was migrated from Trac:
lastique
(andrey.semashev@….com)egmont
(@egmontkob)When I press F3 on a library or executable with lots of exported symbols with long names (typical for C++ libraries), mcview does not always allow to scroll down though all symbols and stops halfway.
Steps to reproduce:
This bug is really annoying because one can't tell if the file has ended or not.
Note
Original attachments:
egmont
(@egmontkob) onApr 30, 2017 at 19:56 UTC
The text was updated successfully, but these errors were encountered: