GNOME Bugzilla – Bug 733606
Line Numbers seems as part of the text editor content
Last modified: 2014-08-26 12:30:04 UTC
Created attachment 281484 [details] Number lines seems as part of the text editor content When you work in a script with gEdit you obviously want to enable the "Display Line Numbers" option. The problem is that the numbers on the left side seem like normal content of your script, and that brings confusion. Some solution: Add a background color (eg a grey), make Number fonts different (eg color, size) and add some more padding from the normal content of the editor. I'm not sure if this was the case in 3.12 as well :)
Some themes have a background in Line Number, but it doesn't totally solve the issue, because of the same font and the small padding.
We can add a background color for the classic and tango style schemes. I think the background is sufficient to know that the line numbers are not part of the contents.
The colors for classic and tango are actually taken from the gtk+ theme. So it should probably be fixed in Adwaita.
Created attachment 281485 [details] Left padding Even if you don't use the line numbering, I think that a small left padding would be still useful. I'm attaching Bracket's padding as an example.
Left padding without a background color is difficult to differentiate from indentation. In the Bracket's screenshot, we can think that all the code is indented with one space.
(In reply to comment #5) > Left padding without a background color is difficult to differentiate from > indentation. In the Bracket's screenshot, we can think that all the code is > indented with one space. Bijiben also uses a left padding, which I think it works okay. Mockups[1] show gEdit with left padding too. [1] https://github.com/gnome-design-team/gnome-mockups/tree/master/gedit
Here is an attempt to fix this bug: https://git.gnome.org/browse/gtksourceview/log/?h=wip/gutter-style The problem is that the classic and tango style schemes don't define the 'line-numbers' style (especially the background color). classic and tango have already other gray colors defined, for example for 'current-line', 'draw-spaces', 'right-margin', etc. So defining 'line-numbers' too should not be a big problem. Or Adwaita could define all these colors, but it is specific to GtkSourceView. The problem is that defining 'line-numbers' without defining 'text' is currently not possible. The problem is that the line-numbers style is applied to the whole GtkTextView with gtk_widget_override_color() and gtk_widget_override_background_color(). It relies on the 'text' style to be applied with CSS on the main GtkTextView region, which overrides the line-numbers style. The small problem is that this hack has repercussions in the gutter renderers. To retrieve the foreground color, they call gtk_widget_get_style_context() on the text view, followed by gtk_style_context_get_color() (it is done at least in gtksourcegutterrenderertext.c). A solution is to define a default value for the GtkSourceGutterRenderer:background-rgba property and create a :foreground-rgba property. The default value would be the 'line-numbers' style if set, or the text view style as a fallback. By doing this, a renderer can use those colors directly. (Currently :background-rgba is not set by default.)
Created attachment 284357 [details] [review] Set line-numbers background for classic and tango To better distinguish the text from the line numbers. #e5e5e0 seems a good value. A gray too dark is ugly, and a gray too light is difficult to see. The blue component (e0) is a bit darker, like for the other gray colors defined in classic. Another possibility is to have a lighter gray background, with a vertical line (same colors as the right margin). Or just a white background with a vertical line.
bug #735368 has a gtk patch that tries to restore the old behavior
Fixed with CSS. It'll be available for GNOME 3.14.