Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Colorizing is not consistent #103

Open
mrdgo opened this issue Sep 2, 2024 · 9 comments
Open

Colorizing is not consistent #103

mrdgo opened this issue Sep 2, 2024 · 9 comments
Labels
waiting waiting for a reply or more info

Comments

@mrdgo
Copy link

mrdgo commented Sep 2, 2024

Hello! At first, I though this was a github-cli bug. So I posted there. The only important point in that issue is this comment. As you can see, the colors that glamour creates, are displayed correctly. However all the colors from gh-cli are not correct. Do you have an idea what the culprit might be? Both less and bat display the correct colors in that case.

@lucc
Copy link
Owner

lucc commented Sep 3, 2024

Maybe this is related to #99 and #101: with version 0.10 neovim changed the default color scheme and I noticed that some colorschemes did implicitly assume some different default colors and did not set them.

Can you reproduce this problem with neovim 0.9 and 0.10 and also with the default colorscheme? (You can use the NVIMPAGER_NVIM variable and the -u or -c/--cmd command line options)

@mrdgo
Copy link
Author

mrdgo commented Sep 3, 2024

I tested on nightly before.

  • Version 0.10: ANSI color doesn't use my color
  • Version 0.9: error: unexpected argument '-R' found

I tried to use bob, but somehow nvimpager doesn't work anymore using bob's installation. How do I fix?

@lucc
Copy link
Owner

lucc commented Sep 3, 2024

If by bob you mean https://github.com/MordechaiHadad/bob I don't know it. Nvimpager does not bother where you put neovim or how you install it. It does however require the command line switches documented in the man page of the official neovim. Especially the -R switch as you have noticed. If bob does something strange to the command line parsing of neovim you have to figure that out first.

You can find out where in nvimpager the error message comes from when running it in debug mode: bash -x nvimpager.

@mrdgo
Copy link
Author

mrdgo commented Sep 5, 2024

When I invoke nvim v0.9.5 with -R, there is no problem. This only occurs when I set NVIMPAGER_NVIM to that binary.

Log: (I removed the prompt-related noise)

user@host: NVIMPAGER_NVIM=~/.local/share/bob/nvim-bin/nvim man sort
++ printf %s 1725513689731314
+ NVIMPAGER_NVIM=~/.local/share/bob/nvim-bin/nvim
+ man sort
error: unexpected argument '-R' found

Usage: nvimpager <COMMAND>

For more information, try '--help'.
man: command exited with status 2: sed -e '/^[[:space:]]*$/{ N; /^[[:space:]]*\n[[:space:]]*$/D; }' | LESS=-ix8RmPm Manual page sort(1) ?ltline %lt?L/%L.:byte %bB?s/%s..?e (END):?pB %pB\%.. (press h for help or q to quit)$PM Manual page sort(1) ?ltline %lt?L/%L.:byte %bB?s/%s..?e (END):?pB %pB\%.. (press h for help or q to quit)$ MAN_PN=sort(1) nvimpager
 3 user@host:~$ .local/share/bob/nvim-bin/nvim -R .bashrc
++ printf %s 1725513713727901
+ .local/share/bob/nvim-bin/nvim -R .bashrc

Weird, isn't it? nvimpager with that binary fails, but nvim -R .bashrc runs like a charm.

@lucc
Copy link
Owner

lucc commented Sep 8, 2024

Your last comment is not very helpful. You are actually not calling nvimpager yourself. You are calling man. If you read the man page of man itself you will learn that man looks at the PAGER and the MANPAGER env variable. So at the very least I would expect you to tell me the contents of these so that we can at least guess who is calling nvimpager in the end.

It would be much better if you can find an example to reproduce this with nvimpager directly. If it only happens with man pages you can have man render a page for you and view it with nvimpager afterwards:

man man > man.1
nvimpager man.1 -c 'Man!' 

The error message

Usage: nvimpager <COMMAND>

looks strange to me. It is not from nvimpager. Do you know where it comes from?

@mrdgo
Copy link
Author

mrdgo commented Sep 9, 2024

Hm. I am sorry about a non-helpful comment. Then I don't understand either. The commands you suggest produce the same output: error: unexpected argument '-R' found. I ran the same thing using strace and the only -R I found, was in execve("/path/to/bobs/v0.9.5/nvim", ["nvimpager", "-R", ...

@lucc
Copy link
Owner

lucc commented Sep 9, 2024

Maybe bob inspects the argv0 of the command that is executed like snap does. Compare the the problems in #82.

Can you check if the nvim versions installed by bob are symlinks or wrapper scripts (if they are symlinks then please also check recursively):

ls -l /path/to/bobs/v0.9.5/nvim
file /path/to/bobs/v0.9.5/nvim

What happens if you run

/path/to/bobs/v0.9.5/nvim -R
exec -a foo /path/to/bobs/v0.9.5/nvim -R

@lucc lucc added the waiting waiting for a reply or more info label Sep 9, 2024
@mrdgo
Copy link
Author

mrdgo commented Sep 9, 2024

That is exactly what I did already, I manually invoked v0.9.5 with -R and in worked. It only fails when invoked by nvimpager.

$ file .local/share/bob/nvim-bin/nvim
.local/share/bob/nvim-bin/nvim: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=adcf999f43a8b51afa6c665656cd26b9d24eda10, for GNU/Linux 4.4.0, stripped

@RayJameson
Copy link

I have same issue error: unexpected argument '-R' found

NVIM v0.10.2
Build type: Release
LuaJIT 2.1.1713484068

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting waiting for a reply or more info
Projects
None yet
Development

No branches or pull requests

3 participants