-
Notifications
You must be signed in to change notification settings - Fork 266
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
git-changebar: Re-set first visible line after Scintilla size request #1280
Conversation
git-changebar/src/gcb-plugin.c
Outdated
@@ -878,6 +878,10 @@ get_widget_for_buf_range (GeanyDocument *doc, | |||
MIN (width + 2, alloc.width), | |||
MIN (height + 1, alloc.height)); | |||
|
|||
/* Size request seems to scroll Scintilla view so we have to re-set visible lines again */ | |||
scintilla_send_message (sci, SCI_SETENDATLASTLINE, 0, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason to re-set ENDATLASTLINE
? I don't see it being needed on my end, did you see an issue without it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it doesn't seem to be necessary, I just copied the two lines above. Repushed without this line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for debugging this up to that point! I somehow didn't notice this until fairly recently, and was puzzled (and frightened) at what it could be, yet didn't have time to dig in. And now I see you did, yay!
I don't see a problem re-asking for the line; although at some point I'll try and understand what changed in Scintilla that would lead to this.
After updating to Scintilla 5.3.7 the Scintilla popup with the diff against git shows the wrong number. It seems that gtk_widget_set_size_request() scrolls Scintilla view so despite it was set previously, it isn't set correctly after this call and has to be re-set. Note that the call to SCI_SETFIRSTVISIBLELINE has to stay at the original location too, otherwise subsequent calculation using SCI_POINTXFROMPOSITION doesn't work because the line may not be visible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
I don't understand what's actually going on, especially as from my tests it seems to work alright without this for lines <= 182 for me (yes, that feels random). Changes on later lines are stuck starting at line 182…
Anyway, this works and shouldn't cause any more problems.
Essential plugin, life would be unbearable without it :-).
I was worried it could be some "unsolvable" conflict with the changebar that is now part of Scintilla. But then all the printfs I added seemed to return the right value and then I displayed line numbers in the Scintilla popup and it was clear it wasn't set correctly.
Yeah, who knows. It's actually kind of surprising that it works now because Anyway, good, it works now, the world seems to be saved for a while :-) |
Ugh… yeah, maybe someday I'll have to figure that out, because it doesn't seem very safe indeed. 🤞
Thanks! 🕵️ |
After updating to Scintilla 5.3.7 the Scintilla popup with the diff against git shows the wrong number.
It seems that gtk_widget_set_size_request() scrolls Scintilla view so despite it was set previously, it isn't set correctly after this call and has to be re-set.
Note that the call to SCI_SETFIRSTVISIBLELINE has to stay at the original location too, otherwise subsequent calculation using SCI_POINTXFROMPOSITION doesn't work because the line may not be visible.
@b4n Does this look OK to you? Maybe there's a better way to fix this problem so take this only as a hint where the problem is.
Fixes #1279