walles / moar

Moar is a pager. It's designed to just do the right thing without any configuration.
Other
676 stars 19 forks source link

Not getting syntax highlighting on python file in ubuntu on WSL. #202

Closed pacanukeha closed 7 months ago

pacanukeha commented 8 months ago

Using Ubuntu 22.04 on WSL, up-to-date. Installed moar using brew install moar moar path/to/file.py

Expected: python syntax is highlighted

Experienced: python syntax is displayed but not highlighted

I thought there might be some sort of conflict with oh-my-posh as a terminal line decorator but I disabled that and it made no difference.

I tried manually installing Chroma from brew and it made no difference.

walles commented 8 months ago

This is super weird.

Can you copy / paste the output of moar --version and moar --help here?

walles commented 7 months ago

Please re-open if you have more information on this @pacanukeha.

pacanukeha commented 7 months ago

hi @walles, I'm very sorry to ignore your question. It turns out that my notification emails have been going to a previous work email and they strangely haven't been helpful enough to forward. anyway – requested output below. I am using oh-my-posh to decorate my command line, I don't know if that would affect anything. Please let me know if there are any environment variables you need.

moar --version
v1.23.10
moar --help
Usage
  moar [options] <file>
  ... | moar
  moar < file

Shows file contents. Compressed files will be transparently decompressed.
Input is expected to be (possibly compressed) UTF-8 encoded text. Invalid /
non-printable characters are by default rendered as '?'.

More information + source code:
  <https://github.com/walles/moar#readme>

Environment
  Additional options are read from the MOAR environment variable if set.
  But currently, the MOAR environment variable is not set.

  PAGER=moar
  TERM=xterm-256color

Options
  -colors value
        Highlighting palette size: 8, 16, 256, 16M, auto
  -debug
        Print debug logs after exiting
  -follow
        Follow piped input just like "tail -f"
  -lang value
        File contents, used for highlighting. Mime type or file extension ("html"). Default is to guess by filename.
  -mousemode mode
        Mouse mode: auto, select or scroll: https://github.com/walles/moar/blob/master/MOUSE.md
  -no-clear-on-exit
        Retain screen contents when exiting moar
  -no-linenumbers
        Hide line numbers on startup, press left arrow key to show (default true)
  -no-statusbar
        Hide the status bar, toggle with '='
  -quit-if-one-screen
        Don't page if contents fits on one screen
  -render-unprintable value
        How unprintable characters are rendered: highlight or whitespace
  -scroll-left-hint value
        Shown when view can scroll left. One character with optional ANSI highlighting.
  -scroll-right-hint value
        Shown when view can scroll right. One character with optional ANSI highlighting.
  -shift amount
        Horizontal scroll amount >=1, defaults to 16
  -statusbar style
        Status bar style: inverse, plain or bold
  -style style
        Highlighting style from https://xyproto.github.io/splash/docs/longer/all.html
  -trace
        Print trace logs after exiting
  -version
        Prints the moar version number
  -wrap
        Wrap long lines
  +1234
        Immediately scroll to line 1234
pacanukeha commented 7 months ago

I do not appear to have the authority to Re-Open this issue.

walles commented 7 months ago

What about moar --trace path/to/file.py?

Then just quit immediately after the (not-highlighted) file shows up.

Should print lots of debug information after you exit the pager, please post here what you get!

pacanukeha commented 7 months ago

here you go! some interesting lines in there.

moar --trace ./get_services.py
Please post the following report at <https://github.com/walles/moar/issues>,
or e-mail it to johan.walles@gmail.com.

Version: v1.23.10
LANG   : C.UTF-8
TERM   : xterm-256color

GOOS    : linux
GOARCH  : amd64
Compiler: gc
NumCPU  : 20

time="Apr 29 14:28:44.815513" level=debug msg="Counted 10 lines in 644.355µs at 64.435µs/line"
time="Apr 29 14:28:44.816578" level=debug msg="Stream read in 682.806µs"
time="Apr 29 14:28:44.866880" level=debug msg="Terminal background color still not detected after 50.351762ms, giving up"
time="Apr 29 14:28:44.866937" level=trace msg="Pager starting"
time="Apr 29 14:28:44.870216" level=trace msg="Reader done, contents explicitly set"
time="Apr 29 14:28:44.870297" level=debug msg="onDone() took 53.712048ms"
time="Apr 29 14:28:46.299281" level=trace msg="ttyin high watermark bumped to 1 bytes"
time="Apr 29 14:28:46.299353" level=trace msg="Handling rune event 'q'/0x0071..."
time="Apr 29 14:28:46.299367" level=trace msg="Pager done"
walles commented 7 months ago

Just made a new release with the fix in it, thanks for reporting @pacanukeha!

The fixed release should show up in Homebrew within an hour or so.

https://github.com/walles/moar/releases/tag/v1.23.11

pacanukeha commented 7 months ago

Great, thanks!