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 586950 - Cursor aspect ratio
Cursor aspect ratio
Status: RESOLVED FIXED
Product: vte
Classification: Core
Component: general
0.20.x
Other All
: Normal minor
: ---
Assigned To: VTE Maintainers
VTE Maintainers
[fixed-0-36][needed-next][commit:f6cc...
Depends on:
Blocks:
 
 
Reported: 2009-06-25 14:03 UTC by Tony Houghton
Modified: 2014-03-27 18:50 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Use the style's cursor-aspect-ratio when drawing the cursor (3.14 KB, patch)
2010-04-08 11:48 UTC, Christian Persch
committed Details | Review
make underline's height equal the ibeam's width (801 bytes, patch)
2013-12-20 12:30 UTC, Paul Bolle
committed Details | Review

Description Tony Houghton 2009-06-25 14:03:20 UTC
I've set "GtkWidget::cursor-aspect-ratio = 0.1" in my .gtkrc-2.0 to make the cursor thicker and therefore easier to spot. When vte's cursor shape is set to I-beam or underline it seems to be only 1 pixel thick, ignoring the rc setting.


Other information:
I use the block cursor shape anyway so this isn't very important to me, but I still think it would be an improvement to allow line cursors to be thicker.
Comment 1 Behdad Esfahbod 2009-06-25 18:12:11 UTC
Good point.  Can't get my gedit to respect it though.  Any idea?
Comment 2 Christian Persch 2009-06-25 18:20:16 UTC
Works here using 

style "cursorstyle" { GtkWidget::cursor-aspect-ratio = 0.5 } class "*" style "cursorstyle"

(that probably not the most elegant / simplest method to get this, but it works).
Comment 3 Tony Houghton 2009-06-25 20:53:00 UTC
I have:

style "tony" {
	GtkWidget::cursor-aspect-ratio = 0.1
	GtkWidget::cursor-color = "#c00040"
	#bg[SELECTED] = "#6081ab"
	bg[SELECTED] = "#859fb8"
}
class "*" style "tony"

I did have class "GtkWidget" but I just changed it to "*" after seeing the last message to see if that would help, but it doesn't.

It works for me with most other widgets, including GtkSourceView (gedit), so it's strange that it doesn't work there for Behdad. Firefox/Iceweasel has always ignored these cursor settings for me BTW.
Comment 4 Christian Persch 2009-06-25 21:30:50 UTC
(Just FYI, that should be fixed in gecko 1.9.1 / ff 3.5, see  https://bugzilla.mozilla.org/show_bug.cgi?id=118308 .)
Comment 5 Behdad Esfahbod 2009-12-03 18:30:39 UTC
Works now.  Thanks.

Looking into fixing in vte.
Comment 6 Tony Houghton 2009-12-03 19:58:55 UTC
I presume comment 5 just means you got it working in gedit? It still doesn't work for me in Firefox. I think the fix above resulted in cursor-color working, but not cursor-aspect-ratio so I've opened a new bug <https://bugzilla.mozilla.org/show_bug.cgi?id=532717>.
Comment 7 Behdad Esfahbod 2009-12-03 20:10:40 UTC
Yes, I wasn't talking about firefox.
Comment 8 Christian Persch 2010-04-08 11:48:34 UTC
Created attachment 158184 [details] [review]
Use the style's cursor-aspect-ratio when drawing the cursor

For the ibeam cursor, use the aspect ratio; for the underline, its
inverse (that's the only thing that makes sense here).

Bug #586950.
Comment 9 Behdad Esfahbod 2010-04-08 14:18:17 UTC
Looks good.  Any reason to use float instead of double?
Comment 10 Christian Persch 2010-04-08 14:25:51 UTC
Well, the style property is float not double, so I just kept it that way. I don't care either way though, so if you want to store the and calculate as doubles, I'll change that.
Comment 11 Behdad Esfahbod 2010-04-08 14:30:25 UTC
Fair enough.  Feel free to commit then.
Comment 12 Christian Persch 2010-04-08 14:38:55 UTC
Pushed to master.
Comment 13 Behdad Esfahbod 2010-04-08 15:08:49 UTC
Humm, for underline cursor I feel like using the same width as the I-beam is closer to my expectation as a user.  What do you think?
Comment 14 Christian Persch 2010-04-08 15:16:00 UTC
I guess you mean same *height* as the width of of the ibeam cursor (because clearly the underline cursor's width should be the full cell) ? I don't know, that seems odd to me.
Comment 15 Tony Houghton 2010-04-08 18:43:31 UTC
I'd like it to be the same thickness rather than the same aspect. My aim in changing the style is to make it slightly thicker (2px instead of 1px at usual font sizes), and I think the underline cursor would generally be slightly shorter than the beam, so it might be prone to reverting to 1px thick.

However, I don't use the underline cursor, so perhaps my opinion on it shouldn't be taken with any weight :-).
Comment 16 Behdad Esfahbod 2010-04-08 20:36:19 UTC
I agree with Tony.  I expect same thickness too.
Comment 17 Paul Bolle 2012-08-02 16:09:38 UTC
(In reply to comment #2)
> style "cursorstyle" { GtkWidget::cursor-aspect-ratio = 0.5 } class "*" style
> "cursorstyle"

To makes sure it's jotted down somewhere, so I can find it again, for gtk 3 this can be achieved (for just vte) with:

$ cat .config/gtk-3.0/gtk.css 
VteTerminal {
    -GtkWidget-cursor-aspect-ratio: 0.1;
}

(In reply to comment #16)
> I agree with Tony.  I expect same thickness too.

Ditto.

The underline's width is smaller than the ibeam's height (when using a font that's higher than it's wide, which is true for many fonts). So the current code makes the surface of the underline quite a bit smaller than the ibeam's surface, for any aspect ratio. And a reasonable cursor aspect ratio makes the underline hard to spot (for my eyes).

And indeed, using a trivial patch to make the underline's height equal the ibeam's width, gives an underline that look better (to me). That is, once the local cursor aspect ratio pushes the ibeam's width to two pixels (and thus the underline's height to two too).
Comment 18 Paul Bolle 2013-12-20 12:30:28 UTC
Created attachment 264611 [details] [review]
make underline's height equal the ibeam's width

(In reply to comment #17) 
> And indeed, using a trivial patch to make the underline's height equal the
> ibeam's width, gives an underline that look better (to me). That is, once the
> local cursor aspect ratio pushes the ibeam's width to two pixels (and thus the
> underline's height to two too).

I just built vte3 0.34.9 with the trivial patch I've carried since 0.30.1. I've attached it for anyone wanting to see whether it really improves things.
Comment 19 Egmont Koblinger 2014-01-05 22:16:22 UTC
+1 for applying Paul's patch, please :)
Comment 20 Yury V. Zaytsev 2014-01-05 22:24:11 UTC
+1 :-)
Comment 21 Egmont Koblinger 2014-01-07 19:07:12 UTC
Fixed in 0-36, keeping open for vte-next.
Comment 22 Christian Persch 2014-03-27 18:50:45 UTC
Fixed on master.