New issue
Advanced search Search tips

Issue 736025 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Nov 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Bug



Sign in to add a comment

hterm: Can't set both guibg and gui=reverse in vim

Reported by theother...@gmail.com, Jun 22 2017

Issue description

Chrome Version       : 58.0.3029.140URLs (if applicable) 

On a samus, running crouton (Ubuntu Xenial 16.04).
When running vim in true color mode ('set termguicolors'), you can't use both the gui=reverse and the guibg="#anything" settings on any highlight. This works properly in gnome-terminal and fails in both the Secure Shell app on the Chrome OS side, and in Hyper terminal on the Ubuntu side. The attached photos show the issue -- one side shows an actual highlight, the other barely highlights. This breaks a bunch of colorschemes in Vim. 

I'm not sure what the escape codes are for this -- should I attach a "script" repro log? Or would the steps below be sufficient?
 
ubuntu-highlighting.png
7.9 KB View Download
Screenshot 2017-06-22 at 12.00.14 PM.png
10.7 KB View Download
Oops, forgot to attach steps:
1) Use a version of vim that supports termguicolors (Nvim or Vim 8)
2) Open it on up; add "set termguicolors" to the .vimrc
3) Try "hi Visual guibg=1 gui=reverse"

Observe that it doesn't reverse the text.

Comment 2 by vapier@chromium.org, Jun 22 2017

sorry, but i don't use vim, so i don't know what (3) means there
Gotcha -- It sets the color scheme for "visual mode" (selecting text). 
guibg sets the color of the bg in truecolor mode
gui=reverse is an attribute that says vim should "inverse" the text.
In the first screenshot, you can see that the text on the right has "inverted". In the second screenshot, it hasn't.

I'd be glad to provide an escape sequence log -- would you be able to help me understand how to set it up to work well with VIM?

Comment 4 by vapier@chromium.org, Jun 22 2017

what i mean is, i'm not seeing how to reproduce your steps.  i run `vim`, and then i type "hi Visual guibg=1 gui=reverse" ?  "h" moves the cursor left, and "i" puts me into insert mode, so the rest of the text gets pasted to the buffer.
Ah, here are some more detailed instructions:
1) Save the attached vimrc-repro as ~/.vimrc
2) Launch Vim 8
3) Type the following: iTest Text (and then hit escape. This should enter some text)
4) Type the following: vhhhhh (should enter visual mode and select some text)

Below are some screens of the same thing in gnome-terminal vs. hterm
vimrc-repro
71 bytes View Download
hterm.png
4.6 KB View Download
gnome-terminal.png
3.3 KB View Download

Comment 6 by vapier@chromium.org, Jun 22 2017

thanks, i think i can see what you're talking about now.  i'll need to play around to see what the expected behavior is.
Cool, thanks for looking into it. Lemme know if there's anything else I can do to help.

Comment 8 Deleted

Comment 9 by vapier@chromium.org, Nov 12 2017

looks like the issue is due to inverse attributes not being applied to true color sources.  the code only recalculates & shuffles foreground/background when it isn't already in rgb mode.

we'll need to rework the hterm.TextAttributes API and how we handle foreground/foregroundSource.
Project Member

Comment 10 by bugdroid1@chromium.org, Nov 20 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/apps/libapps/+/e741552efe93e690d21551bceccf503b078a191d

commit e741552efe93e690d21551bceccf503b078a191d
Author: Mike Frysinger <vapier@chromium.org>
Date: Mon Nov 20 21:04:47 2017

hterm: fix handling of inverse text with true colors

The text attribute code would update the foreground/background colors
only when they weren't already in true color form.  This was somewhat
intentional in that updates to the color (like bolding and faint) are
for non-true color sources, but it unintentionally missed flipping the
foreground & background colors when inverse is active.

We fix this by not writing directly to the foreground/background attrs
when setting true colors.  This lets us always treat them as outputs
by the sync code.  Instead, we continue using the "source" attrs like
we do for the palette based colors.  This lets us drop the SRC_RGB
constant as there are no more users.

BUG= chromium:736025 

Change-Id: Id10ffcefcbac69d0d920de12cac910065d8902a5
Reviewed-on: https://chromium-review.googlesource.com/765590
Reviewed-by: Brandon Gilmore <varz@google.com>
Tested-by: Mike Frysinger <vapier@chromium.org>

[modify] https://crrev.com/e741552efe93e690d21551bceccf503b078a191d/hterm/js/hterm_text_attributes.js
[modify] https://crrev.com/e741552efe93e690d21551bceccf503b078a191d/hterm/js/hterm_text_attributes_tests.js
[modify] https://crrev.com/e741552efe93e690d21551bceccf503b078a191d/hterm/js/hterm_vt.js

Owner: vapier@chromium.org
Status: Fixed (was: Available)
should be fixed as of hterm-1.75 and nassh-0.8.40

Sign in to add a comment