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 602596 - Cursor can become invisible
Cursor can become invisible
Status: RESOLVED FIXED
Product: vte
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: VTE Maintainers
VTE Maintainers
: 473170 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2009-11-21 19:38 UTC by Behdad Esfahbod
Modified: 2010-08-22 10:17 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Behdad Esfahbod 2009-11-21 19:38:44 UTC
If the fg color is the bright version of the bg color.
(see bug 597242)
Comment 1 Szigeti János 2009-12-25 23:42:57 UTC
Hi,

to overcome this problem and to see the cursor (generally, all reverse bold/bright text) whenever fg and bg base colors are identical, I wrote a patch like this:

--- vte.c.orig	2009-12-19 13:48:08.000000000 +0100
+++ vte.c	2009-12-25 23:20:39.000000000 +0100
@@ -8648,7 +8648,10 @@
 				*fore = VTE_BOLD_FG;
 			} else
 			if ((*fore != VTE_DEF_BG) && (*fore < VTE_LEGACY_COLOR_SET_SIZE)) {
-				*fore += VTE_COLOR_BRIGHT_OFFSET;
+				if (*fore==*back && (reverse ^ ((cell != NULL) && (cell->attr.reverse))))
+					*back += VTE_COLOR_BRIGHT_OFFSET;
+				else
+					*fore += VTE_COLOR_BRIGHT_OFFSET;
 			}
 		}
 		if (cell->attr.half) {

So in case of reverse text, bg is set to bright instead of fg.

Note that this patch/hack violates the concept that even in reverse text the fg should get bright in case of bold/bright text mode, I would apply this patch or something similar just optionally (activated by some #define macro etc.).
Comment 2 Behdad Esfahbod 2009-12-31 20:23:52 UTC
*** Bug 473170 has been marked as a duplicate of this bug. ***
Comment 3 Yury V. Zaytsev 2010-03-31 09:29:37 UTC
Four years and counting? There are at least 3 different patches available to solve this issue (two of them in #473170)... Any chance to get it fixed one day?
Comment 4 Behdad Esfahbod 2010-03-31 18:06:28 UTC
Fixed.  FWIW, none of the three patches were correct.
Comment 5 Rafał Mużyło 2010-03-31 19:50:22 UTC
When/How exactly was it fixed, as 0.24.0 still shows the bug
and I don't see anything relevant on top of the master ?
Comment 6 Behdad Esfahbod 2010-03-31 19:55:51 UTC
Sorry, my push had failed.  Pushed now.

Here's the patch for the record:

commit b58bc5359085d2c9233ac6d6a265645bfa217e82
Author: Behdad Esfahbod <behdad@behdad.org>
Date:   Wed Mar 31 14:05:10 2010 -0400

    Bug 602596 - Cursor can become invisible
    
    Always compute the full fore/back color first, then reverse.
    That's what xterm does also.

diff --git a/src/vte.c b/src/vte.c
index 178010b..c6844e9 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -8760,10 +8760,6 @@ vte_terminal_determine_colors(VteTerminal *terminal,
        if (highlight && !cursor && terminal->pvt->highlight_color_set) {
                *fore = cell ? cell->attr.fore : VTE_DEF_FG;
                *back = VTE_DEF_HL;
-       } else
-       if (reverse ^ ((cell != NULL) && (cell->attr.reverse))) {
-               *fore = cell ? cell->attr.back : VTE_DEF_BG;
-               *back = cell ? cell->attr.fore : VTE_DEF_FG;
        } else {
                *fore = cell ? cell->attr.fore : VTE_DEF_FG;
                *back = cell ? cell->attr.back : VTE_DEF_BG;
@@ -8796,6 +8792,13 @@ vte_terminal_determine_colors(VteTerminal *terminal,
                        }
                }
        }
+
+       if (reverse ^ ((cell != NULL) && (cell->attr.reverse))) {
+         int tmp;
+         tmp = *fore;
+         *fore = *back;
+         *back = tmp;
+       }
 }
 
 /* Check if a unicode character is actually a graphic character we draw
Comment 7 Rafał Mużyło 2010-03-31 21:24:59 UTC
Thanks, applies cleanly and works with 0.24.0,
pity it didn't made into this Gnome release.

On a not really related note: personally,
I find compiler warnings like "/usr/include/gtk-2.0/gtk/gtkitemfactory.h:47: warning: function declaration isn’t a prototype" quite amusing,
though "vtemodule.c:19:2: warning: #ident is a deprecated GCC extension"
should probably be fixed, just in case upstream removes it.
Comment 8 Behdad Esfahbod 2010-03-31 23:06:02 UTC
(In reply to comment #7)
> Thanks, applies cleanly and works with 0.24.0,
> pity it didn't made into this Gnome release.

Will push it into 0.24.1 for GNOME 2.30.1.

> On a not really related note: personally,
> I find compiler warnings like "/usr/include/gtk-2.0/gtk/gtkitemfactory.h:47:
> warning: function declaration isn’t a prototype" quite amusing,

That's indeed the wrong warning.  The actual warning should be "old-style function declaration" or something like that.  Unfortunately we cannot fix that as the comments suggest:

/* We use () here to mean unspecified arguments. This is deprecated 
 * as of C99, but we can't change it without breaking compatibility. 
 * (Note that if we are included from a C++ program () will mean 
 * (void) so an explicit cast will be needed.) 
 */ 
typedef↦void↦   (*GtkItemFactoryCallback)  (); 


> though "vtemodule.c:19:2: warning: #ident is a deprecated GCC extension"
> should probably be fixed, just in case upstream removes it.

Fixed.  I typically just run make in src/ so I never noticed that.
Comment 9 Yury V. Zaytsev 2010-04-01 07:12:03 UTC
Hey Behdad! 

You ARE the MAN. I'm not a vte dev, so I had no clue the patches were incorrect, but at least they worked for me. Many thanks, now I can stop building my own packages of vte for Ubuntu just to make mc usable.

Cheers,
--Yury.