vimcat icon indicating copy to clipboard operation
vimcat copied to clipboard

Does not produce colors when invoked from within the curses enviornment

Open peey opened this issue 7 years ago • 2 comments

Hi

We've been trying to debug some weird behaviour when using vimcat inside of ranger. ranger uses highlight 1 2 to highlight the source code and we wanted to also use vimcatas a replacement for that.

If vimcat is invoked on my system, then

  1. If I invoke it from my terminal, I see colors
  2. If I redirect output to a file and cat that file, I see colors
  3. If I cat the file from within ranger (by replacing highlight with cat) then I see colors

If vimcat is invoked from within ranger (in ncurses enviornment), then

  1. We don't see colors
  2. If I redirect the output to a file and cat that file outside ranger, I don't see colors

I think what's happening is that there's something about the enviornment from which vimcat is invoked which causes it not to produce any colors.

The original issue is at https://github.com/ranger/ranger/issues/657

peey avatar Jan 22 '19 16:01 peey

Hi,

Do you have any way to test within a similar ncurse environment interactively, so we can run vim and inspect for differences? vim plays well within tmux or screen so I don't quite know what to do.

I've compared the environments and only found that these variables are added :

ESCDELAY=25
PAGER=less
RANGER_LEVEL=1

and SHLVL is raised to 2 instead of 1. But by testing manually with these environment variables, vim isn't affected.

tput colors returns 8 like in my terminal. But I think that ncurse as set by ranger is affecting vim set termcap output and the options it lists.

ofavre avatar Jan 25 '19 11:01 ofavre

This might have to do with pycurses which ranger uses. I'll try to get you a minimal reproducible environment and post it here.

Alternately, is there a easier way than digging through source through which I could get all variable settings of the curses environment for ranger?

peey avatar Feb 09 '19 08:02 peey