Repository: sharkdp/bat (language: rust)

Issue:
Syntax highlighting breaks after `-` in a man page
Hi! Incorrect highlighting for a man page after `-` (see the screenshot).

<img width="573" alt="Screenshot" src="https://github.com/user-attachments/assets/d3ec17eb-ac3e-4170-b066-d2aff2bcfb80" />

system
------

**$ uname -srm**
Darwin 23.6.0 arm64

**$ sw_vers**
ProductName:		macOS
ProductVersion:		14.6.1
BuildVersion:		23G93

bat
---

**$ bat --version**
bat 0.24.0

**$ env**
PAGER=less. Set as MANPAGER via `sh -c 'col -bx | bat -l man -p'`

**$ bat --list-languages**
Found custom syntax set.

**$ bat --list-themes**
Found custom theme set.

bat_config
----------

```
--theme='Catppuccin Macchiato'
```

bat_wrapper
-----------

No wrapper script for 'bat'.

bat_wrapper_function
--------------------

No wrapper function for 'bat'.

**$ /bin/zsh --login -i -c type cat**
```
cat is an alias for bat
```

tool
----

**$ less --version**
less 668 (PCRE2 regular expressions)



Discussion / hints:
Hi, thanks for reporting. I would like to reproduce the issue locally and write a regression test, could you tell me which man page is that from please?
Ghostscript

```sh
$ gs --version
9.55.0

$ man gs
```

<img width="709" alt="man gs bug" src="https://github.com/user-attachments/assets/63821dbf-e218-46fd-be71-69668a26cdec" />

This depends on the viewport width apparently.

<img width="1482" alt="bug" src="https://github.com/user-attachments/assets/ca20570b-c270-4297-bc35-2d2cedb3106e" />


Fix patch:
diff --git a/assets/syntaxes/02_Extra/Manpage.sublime-syntax b/assets/syntaxes/02_Extra/Manpage.sublime-syntax
index 2475da8a0f..0779ce04fe 100644
--- a/assets/syntaxes/02_Extra/Manpage.sublime-syntax
+++ b/assets/syntaxes/02_Extra/Manpage.sublime-syntax
@@ -85,6 +85,9 @@ contexts:
 
   options:
     # command-line options like --option=value, --some-flag, or -x
+    - match: '^[ ]{7}(-)(?=\s)'
+      captures:
+        1: entity.name.command-line-option.man
     - match: '^[ ]{7}(?=-|\+)'
       push: expect-command-line-option
     - match: '(?:[^a-zA-Z0-9_-]|^|\s){{command_line_option}}'


Test patch:
diff --git a/assets/syntaxes/02_Extra/syntax_test_man.man b/assets/syntaxes/02_Extra/syntax_test_man.man
index 01ce1c55e6..5dfee5be03 100644
--- a/assets/syntaxes/02_Extra/syntax_test_man.man
+++ b/assets/syntaxes/02_Extra/syntax_test_man.man
@@ -131,6 +131,12 @@ OPTIONS
 #                                ^^ - variable
               output NUM (default 3) lines of copied context
 
+       -      This is  not really a switch, but indicates that standard input
+#      ^ entity.name.command-line-option.man
+#       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - entity - variable
+              is coming from a file or a pipe and not interactively from the
+              command line.
+
 EXAMPLE
        #include <stdio.h>
 #      ^^^^^^^^ source.c meta.preprocessor.include keyword.control.import.include