walles / moar

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

Syntax Highlighting Issue after v1.2+ #86

Closed superguineapig closed 2 years ago

superguineapig commented 2 years ago

Description

First, I love moar. I've been using it for a couple of years now as my primary pager, and it's great!

I recently wound up re-installing moar through homebrew, without errors or warnings, and now all languages colorize the same way; with strange blue/gray highlighting:

Here's a .go file:

example_go

a .json file

example_json

a .js file

example_js

a .cc file

example_cc

Additional testing

I also tried building direct from source for all versions below latest until it worked again. Lo and behold, tag 1.2 produced the correct syntax highlighting. Apparently, my previous version must have been at or before 1.2.

a .go file viewed with moar @ 1.2 (same terminal and env)

example_go_1_2

Really not sure what my setup doesn't like about versions >1.2

Any guidance would be appreciated.

Details

Mac OS: 12.3 Mac Terminal.app: 2.12.5 (default) Moar: 1.9.0 as installed via Homebrew, or built from source; all tags >1.2 Homebrew: 3.4.4 Go: 1.17.8 Shell: bash ENV:

TERM=xterm-256color
LANG=en_US.UTF-8
MOAR=""
$ locale
LANG="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_CTYPE="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_ALL=

Thank you!

walles commented 2 years ago

Thank you for your excellent analysis @superguineapig ⭐.

I get the exact same symptoms using the built-in Terminal application, haven't figured out why yet, but I confirm this.

Personally I'm on iTerm, which is why I never noticed.

walles commented 2 years ago

Running with moar --colors=256 moar.sh works around this problem.

This is a workaround rather than a solution, but even so it is a step in the right direction.

walles commented 2 years ago

Fixed in v1.9.1, should be out in Homebrew soon: https://github.com/Homebrew/homebrew-core/pull/98352

superguineapig commented 2 years ago

@walles looks good. Thanks for looking at this so quickly!