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 You can view, comment on, or merge this pull request online at:
https://github.com/geany/geany-plugins/pull/1280
-- Commit Summary --
* git-changebar: Re-set first visible line after Scintilla size request
-- File Changes --
M git-changebar/src/gcb-plugin.c (4)
-- Patch Links --
https://github.com/geany/geany-plugins/pull/1280.patch https://github.com/geany/geany-plugins/pull/1280.diff
@b4n commented on this pull request.
@@ -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);
any reason to re-set `ENDATLASTLINE`? I don't see it being needed on my end, did you see an issue without it?
@b4n commented on this pull request.
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.
@techee pushed 1 commit.
9ad218bcdd6f57550bbcc2932c01bc71d89f2316 git-changebar: Re-set first visible line after Scintilla size request
@techee commented on this pull request.
@@ -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);
No, it doesn't seem to be necessary, I just copied the two lines above. Repushed without this line.
@b4n approved this pull request.
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.
Thanks a lot for debugging this up to that point!
Essential plugin, life would be unbearable without it :-).
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.
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.
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.
Yeah, who knows.
It's actually kind of surprising that it works now because `SCI_POINTXFROMPOSITION` didn't work when I removed `SCI_SETFIRSTVISIBLELINE` in front of the size request and moved it behind - so `SCI_POINTXFROMPOSITION` works only for the displayed editor area but in this case it isn't displayed yet and `sci` has some who-knows-what size before the size request. But I don't know how this could be fixed.
Anyway, good, it works now, the world seems to be saved for a while :-)
It's actually kind of surprising that it works now because `SCI_POINTXFROMPOSITION` didn't work when I removed `SCI_SETFIRSTVISIBLELINE` in front of the size request and moved it behind - so `SCI_POINTXFROMPOSITION` works only for the displayed editor area but in this case it isn't displayed yet and `sci` has some who-knows-what size before the size request. But I don't know how this could be fixed.
Ugh… yeah, maybe someday I'll have to figure that out, because it doesn't seem very safe indeed. :crossed_fingers:
Anyway, good, it works now, the world seems to be saved for a while :-)
Thanks! :detective:
Merged #1280 into master.
github-comments@lists.geany.org