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 119922 - cursor color should change when foreground & background color do
cursor color should change when foreground & background color do
Status: RESOLVED FIXED
Product: gedit
Classification: Applications
Component: general
git master
Other All
: High normal
: GNOME2.8
Assigned To: Gedit maintainers
gedit QA volunteers
: 116915 151409 156049 (view as bug list)
Depends on: 79585
Blocks:
 
 
Reported: 2003-08-15 00:43 UTC by Nelson Benitez
Modified: 2005-01-14 17:49 UTC
See Also:
GNOME target: ---
GNOME version: 2.9/2.10


Attachments
preliminary patch to address cursor color changes (2.63 KB, patch)
2003-08-15 16:06 UTC, Eric Ritezel
none Details | Review
Semi-working patch (3.09 KB, patch)
2004-07-16 16:02 UTC, Paolo Maggi
needs-work Details | Review
Patch to change the cursor color of first document. (1.02 KB, patch)
2004-12-15 12:44 UTC, Santhosh Hiriyur Shankar
none Details | Review
updated patch (3.52 KB, patch)
2005-01-14 13:47 UTC, Paolo Borelli
none Details | Review

Description Nelson Benitez 2003-08-15 00:43:13 UTC
Description of Problem:
When I change the background color to BLACK, and
the foreground color to whatever color (like red),
then I can't navigate my text because the cursor
has merged with background because the cursor
color is always black. I did that configuration so
gedit looked like a terminal,and I could rest my
eyes ;).

PROBLEM:
Cursor color is ALWAYS BLACK, so if I change my
background color to black, then I have no cursor.

SOLUTION:
The cursor MUST take automatically the color of
the currently foreground color. Another bigger
solution is to let the user choose the cursor
color (like back and foreground),but I prefer
better the first and lightweight solution.

Steps to reproduce the problem:
1.change background color to Black
(prefer->Editor->color) 

2.change foreground color to whatever color,like
red... 

3.Try navigate text,,it's very difficult since you
don't know what exactly the cursor is. 


Actual Results:
Cursor stays in black color so it's merged with
background.

Expected Results:
Cursor gets the foreground color.

How often does this happen? 
Always you reproduce it.


Additional Information:
I have Gedit 2.0.2
Comment 1 Eric Ritezel 2003-08-15 16:05:32 UTC
The solution is "obvious," in the sense of being well documented, but
it isn't "pretty," in the sense of being good.

Currently the only way to do this is to create a mini-rc file inside
the source and modify the "cursor-color" style attribute therewith
on-the-fly.  Nasty stuff, but it's pretty common and not incredibly
expensive.

In my preliminary implementation, the transition between common ("Use
system colors" checked) and user-defined (unchecked) is rough.  For
long-term use, however, the implementation may be adequate.
Comment 2 Eric Ritezel 2003-08-15 16:06:35 UTC
Created attachment 19239 [details] [review]
preliminary patch to address cursor color changes
Comment 3 Elijah Newren 2003-08-15 21:45:13 UTC
Adding PATCH keyword and setting priority to high because of the patch.
Comment 4 Eric Ritezel 2003-08-16 11:45:54 UTC
*** Bug 116915 has been marked as a duplicate of this bug. ***
Comment 5 Paolo Maggi 2003-08-23 17:15:31 UTC
Eric: as I told you on IRC, I don't like this patch very much. We will
be able to solve this problem when gtk+ will provide a function to
change the color of the cursor. There is already a bug report against
gtk+ requesting such new function.

Comment 6 Paolo Maggi 2003-08-23 17:16:16 UTC
Removing PATCH keyword and setting priority to Normal
Comment 7 Paolo Maggi 2003-08-23 17:16:48 UTC
Removing PATCH keyword and setting priority to Normal
Comment 8 Paolo Maggi 2003-12-20 10:17:06 UTC
Eric: since this bug is still not fixed in gtk+, I'm changing my mind
about your patch (for gedit 2.5.x).

May you please rewrite it by creating a function

void gedit_view_modify_cursor_color (GeditView *view, 
                                     GdkColor  *color);

with a big /* FIXME: this is a workaround waiting for bug #XXXX.
Please, rewrite it when the bug will be finally fixed in gtk+ */

Thanks,
Paolo
Comment 9 Paolo Maggi 2003-12-30 17:12:37 UTC
Eric: giving a look to you patch I have seen a problem.
You should be able to change the color of the cursor on a per-view
basis. You cannot do it with your patch.

I think the only solution is to write a patch for GtkTextView. I have
given a look at the code, it should not be too difficult.
Comment 10 Paolo Maggi 2004-03-05 17:53:31 UTC
From bug #79585:


------- Additional Comments From Owen Taylor 2004-02-29 11:34 -------

You *can* manage to change the cursor color by setting a 
name on the widget and using gtk_rc_parse_string(). Not
nice at all though.





Comment 11 Paolo Maggi 2004-07-16 16:02:39 UTC
Created attachment 29587 [details] [review]
Semi-working patch

This patch seems to work quite well, but for some weird reason does not change
the color of the cursor of the first document.
Before committing the patch we should change it so that it modifies the
cursor-secondary-color too.
Comment 12 Paolo Maggi 2004-08-30 10:32:14 UTC
*** Bug 151409 has been marked as a duplicate of this bug. ***
Comment 13 John Spray 2004-09-20 20:09:03 UTC
This appears to be fixed now: I'm using a black-background theme and the cursor
comes up in a sort of yellow-ish colour (as it does in GtkEntrys).
Comment 14 Christian Neumair 2004-09-21 16:20:43 UTC
What GTK+ version are you on?

regs,
 Chris
Comment 15 Paolo Borelli 2004-10-21 15:48:54 UTC
*** Bug 156049 has been marked as a duplicate of this bug. ***
Comment 16 Loïc Minier 2004-11-27 09:25:23 UTC
This has been requested in Debian too, this is Debian bug
<http://bugs.debian.org/283158>.
Comment 17 Santhosh Hiriyur Shankar 2004-12-15 12:43:08 UTC
Paolo, the patch you have proposed does not change cursor color for first
document because: when gedit_view_modify_cursor_color() is called to modify the
cursor color, for first document its just picking the color that was previously
set. However, call to gtk_rc_parse_string sets curosr color, which is used by
subsequent documents. 
Base-line is: First document always lags behind with the current changes. 

I could not figure out why gtk_rc_parse_string is not changing the cursor color
for the first time itself.

I have a fix, though it looks quite nascent. I am looking at ways to improve
this fix. Even call to gtk_rc_parse_string() twice is not doing the job, thats
what is annoying me. I am looking if there is any gtk function which would make
all widgets use the recent changes in their properties, something like refresh
to reflect recent changes.
Comment 18 Santhosh Hiriyur Shankar 2004-12-15 12:44:44 UTC
Created attachment 34857 [details] [review]
Patch to change the cursor color of first document.
Comment 19 Paolo Borelli 2005-01-14 13:47:48 UTC
Created attachment 36011 [details] [review]
updated patch

this is an updated versions of paolo's patch: it applies ceanly to current cvs
HEAD, has some minor cleanups and most importantly adds
gtk_widget_reset_rc_styles (GTK_WIDGET (view->priv->text_view)) to the
gedit_view_modify_cursor_color(), so that the cursor color is updated also for
the first view[1].


[1]: don't ask me why, but it does work :)
Comment 20 Paolo Borelli 2005-01-14 17:49:11 UTC
fixed in cvs head