delta icon indicating copy to clipboard operation
delta copied to clipboard

Repair --default-language, and highlight using full filename

Open th1000s opened this issue 2 years ago • 2 comments

Repair --default-language, and highlight using full filename

Fixed that the "txt" fallback was used instead of --default-language

And when looking for syntax highlighting, keep the filename around as long as possible.

Using simple custom logic (filename > 4) a Makefile can be highlight with make syntax, but a cc or ini file does not get treated like a .cc or .ini file.

Currently the underlying highlighting lib syntect and the sublime syntex definitions can not make this distinction (http://www.sublimetext.com/docs/syntax.html).


Plus clippy warnings

th1000s avatar Oct 03 '23 13:10 th1000s

The filename cutoff is 4, not 3 (from actual DOS 8.3 filenames) because of newer extensions like .toml and .flac. And I could not think of file formats without extensions which are just 4 short and have a meaning by itself, like Makefile. Maybe this could even be extended to 5.

This should fix #1513

th1000s avatar Oct 03 '23 13:10 th1000s

@th1000s I just saw you submitted a PR for an issue I reported. Thank you! do you by any chance to incorporate the feedback comments from @dandavison ? I'd love to see your fix applied. Thanks!

tbm avatar Nov 27 '23 02:11 tbm

Thanks @th1000s!

(The MacOS build failure occurs on main; I am not sure why yet)

dandavison avatar May 04 '24 13:05 dandavison