After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 765699 - Not showing line numbers
Not showing line numbers
Status: RESOLVED FIXED
Product: bluefish
Classification: Other
Component: editor widget
2.2.7
Other Linux
: Normal normal
: 2.2.7
Assigned To: Bluefish Maintainer(s)
Bluefish Maintainer(s)
: 767518 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2016-04-27 22:40 UTC by dpsoft
Modified: 2016-10-29 20:14 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Screenshot (39.19 KB, image/png)
2016-04-27 22:40 UTC, dpsoft
  Details
gtk messages when bluefish started in a shell (1.94 KB, text/plain)
2016-05-08 22:52 UTC, dpsoft
  Details
patch for bug 765699 (5.67 KB, patch)
2016-06-05 23:23 UTC, Jim Hayward
none Details | Review
screenshot of distance (16.39 KB, image/png)
2016-06-06 09:37 UTC, dpsoft
  Details
screenshot spacing different theme (56.12 KB, image/png)
2016-06-06 12:00 UTC, Jim Hayward
  Details

Description dpsoft 2016-04-27 22:40:57 UTC
Created attachment 326902 [details]
Screenshot

I'm using Archlinux with MATE desktop. Since an gtk3 and mate update 2-3 weeks ago, bluefish 2.2.8 is not showing line numbers any more. 

I tried:

- bluefish svn-version
- change many gtk/mate-themes
- delete $HOME/.bluefish/

but without any success.

Thank you!
Comment 1 dpsoft 2016-04-29 11:37:20 UTC
Information: Same problem on another Archlinux computer with MATE desktop.
Comment 2 Olivier Sessink 2016-05-07 19:03:19 UTC
I have not a clue what could cause this... I've not yet seen this on other computers. Perhaps mate has a patch on gtk that interferes with this feature?
Comment 3 dpsoft 2016-05-08 22:50:18 UTC
What can i do for find/debugging the problem? I use bluefish every day for work :(
Comment 4 dpsoft 2016-05-08 22:52:20 UTC
Created attachment 327486 [details]
gtk messages when bluefish started in a shell
Comment 5 Olivier Sessink 2016-05-10 20:33:02 UTC
The errors you posted are errors in the GTK theme that you use. 

Have you tried if this is a theme issue? If you change to a different gtk theme, does that change anything?
Comment 6 dpsoft 2016-05-10 23:24:37 UTC
Okay. I tried every theme on my system. Adwaita, Mate Themes, Traditional Themes, Vertex Themes and so on. 

Of couse the theme in bluefish changed, but with every theme there is a "blank" line numbers column on the left. Same issue on my friends laptop with archlinux and mate-desktop, too.

Thank you! :)
Comment 7 Jim Hayward 2016-05-14 02:25:54 UTC
This bug is being caused by a change in behavior introduced with the release of GTK 3.20.

I have been really busy at work. So I have not yet had time to look at exactly what it causing the problem. It effects anything displayed in the left margin. Not just the line numbers.

I should have time to fix it this weekend.
Comment 8 Jim Hayward 2016-05-16 13:06:09 UTC
I spent a couple hours on this last night with no luck fixing this bug yet.

What I see is broken, there may be more...

Anything displayed in the left margin. The right margin still works.
Current line highlighting
Highlight cursor position

A search this morning turned up a couple useful links. But a quick try this morning with the changes listed still did not fix the bug. I'll try to look at it some more tonight.

https://blogs.gnome.org/mclasen/2015/11/20/a-gtk-update/

https://feaneron.com/2016/01/04/quick-guide-to-port-an-app-for-gtk-3-20/
Comment 9 jib2.form 2016-05-26 06:09:40 UTC
Any news for this annoying bug: bluefish is almost unusable without line numbers.
Comment 10 Jim Hayward 2016-05-26 13:18:54 UTC
My apologies i have not had time to look at this again. I'm hoping that the upcoming holiday weekend will give me the time to finally resolve this issue.
Comment 11 jib2.form 2016-05-26 16:35:59 UTC
Thanks. Bluefish is an awesome app, and we like it bug free! :)
Comment 12 Jim Hayward 2016-05-30 20:45:40 UTC
Just an update for everyone. 

Apparently in GTK 3.20 the way layers are drawn on GtkTextView was changed. A draw_layer vfunc was added in GTK 3.14, but it's behavior was changed in 3.20.

From the docs..

The draw_layer vfunc is called before and after the text view is drawing its own text. Applications can override this vfunc in a subclass to draw customized content underneath or above the text. In the GTK_TEXT_VIEW_LAYER_BELOW_TEXT and GTK_TEXT_VIEW_LAYER_ABOVE_TEXT the drawing is done in the buffer coordinate space, but the older (deprecated) layers GTK_TEXT_VIEW_LAYER_BELOW and GTK_TEXT_VIEW_LAYER_ABOVE work in viewport coordinates, which makes them unnecessarily hard to use.


These were added in 3.20 and the old ones depreciated.

GTK_TEXT_VIEW_LAYER_BELOW_TEXT
The layer rendered below the text (but above the background). Since: 3.20
 
GTK_TEXT_VIEW_LAYER_ABOVE_TEXT
The layer rendered above the text. Since: 3.20

Because we currently draw the left margin before the parent class draw event is called, our left margin is being painted over. Simply moving the call to the parent class draw event first restores the left margin. However this is not the fix. Highlight current line and highlight cursor position overwrite the drawn text.

For GTK >= 3.20 all of the custom drawing code will have to be moved/rewritten to work in the draw_layer vfunc.
Comment 13 Olivier Sessink 2016-06-05 12:24:57 UTC
I'm trying to install a virtual machine with gtk 3.2 (fedira rawhide failed, so switching to ubuntu unstable right now) to see if I can work it out
Comment 14 Olivier Sessink 2016-06-05 15:17:37 UTC
ok, I can reproduce it now.
Comment 15 Jim Hayward 2016-06-05 23:23:47 UTC
Created attachment 329168 [details] [review]
patch for bug 765699

Patch is attached. It should be tested to make sure it still compiles/works with GTK versions < 3.20 before it's committed.
Comment 16 dpsoft 2016-06-06 09:37:40 UTC
Created attachment 329176 [details]
screenshot of distance

Thanks, the patch works fine on Arch! Harmless blemishes: the distance between line numbers and content looks a littlebit tiny.
Comment 17 Jim Hayward 2016-06-06 12:00:52 UTC
Created attachment 329183 [details]
screenshot spacing different theme

A different theme on my system makes the small gap not as noticeable. A slightly larger spacing would look better.
Comment 18 Olivier Sessink 2016-06-06 20:19:16 UTC
the patch works fine on gtk 3.10 and gtk 3.20

The gtk-3.20 test was in a virtual machine in which Xorg took a few times 100% cpu while testing but that might be caused by the VM and not by the patch.

My only problem is: why does the patch work? your code touches the cursor and current line highlighting, not the line numbers? Or was the call to the parent class draw function missing for the line numbers?
Comment 19 Jim Hayward 2016-06-07 01:49:45 UTC
(In reply to Olivier Sessink from comment #18)

> The gtk-3.20 test was in a virtual machine in which Xorg took a few times
> 100% cpu while testing but that might be caused by the VM and not by the
> patch.

That's a vm issue. Not a problem with the patch. Works fine with GTK 3.20.

> 
> My only problem is: why does the patch work? your code touches the cursor
> and current line highlighting, not the line numbers? Or was the call to the
> parent class draw function missing for the line numbers?

The call to the parent class draw event was always there and still is in the same place for older GTK versions. It just needs to be called first with GTK 3.20 or the left margin is drawn then painted over. I added a 3.20 only call first. The left margin, current line and cursor highlighting were all broken by the changes in 3.20. 

From my earlier reply in comment 12. 
This is a key part...

"In the GTK_TEXT_VIEW_LAYER_BELOW_TEXT and GTK_TEXT_VIEW_LAYER_ABOVE_TEXT the drawing is done in the buffer coordinate space, but the older (deprecated) layers GTK_TEXT_VIEW_LAYER_BELOW and GTK_TEXT_VIEW_LAYER_ABOVE work in viewport coordinates"

It took me while to figure out what they changed in 3.20. I knew what the problem was as soon as I read the above in the docs. Everything I could find before that passage, led to believe it was just a color related issue from all the CSS changes in 3.20. It drove me crazy for a little while trying to figure it out.
Comment 20 Jim Hayward 2016-06-11 15:17:33 UTC
*** Bug 767518 has been marked as a duplicate of this bug. ***
Comment 21 elephont 2016-09-14 13:20:22 UTC
I can confirm the patch works on Bluefish 2.2.8