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

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

Closed
pacanukeha opened this issue Mar 11, 2024 · 8 comments
Closed

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

pacanukeha opened this issue Mar 11, 2024 · 8 comments

Comments

@pacanukeha
Copy link

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
Copy link
Owner

walles commented Mar 12, 2024

This is super weird.

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

@walles
Copy link
Owner

walles commented Apr 6, 2024

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

@walles walles closed this as completed Apr 6, 2024
@pacanukeha
Copy link
Author

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
Copy link
Author

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

@walles walles reopened this Apr 29, 2024
@walles
Copy link
Owner

walles commented Apr 29, 2024

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
Copy link
Author

pacanukeha commented Apr 29, 2024

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 added a commit that referenced this issue Apr 29, 2024
Before this change, we just didn't highlight in this case.

With this change in place, we now fall back on the default dark theme
when background color detection fails.

Fixes <#202>.
@walles
Copy link
Owner

walles commented Apr 29, 2024

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

@walles walles closed this as completed Apr 29, 2024
@pacanukeha
Copy link
Author

Great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants