GNOME Bugzilla – Bug 602596
Cursor can become invisible
Last modified: 2010-08-22 10:17:06 UTC
If the fg color is the bright version of the bg color. (see bug 597242)
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.).
*** Bug 473170 has been marked as a duplicate of this bug. ***
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?
Fixed. FWIW, none of the three patches were correct.
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 ?
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
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.
(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.
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.