Skip to content

New option -U, --context-lines to solve incorrect multiline syntax highlighting#2124

Draft
dandavison wants to merge 2 commits intomainfrom
syntax-hl-context-fix
Draft

New option -U, --context-lines to solve incorrect multiline syntax highlighting#2124
dandavison wants to merge 2 commits intomainfrom
syntax-hl-context-fix

Conversation

@dandavison
Copy link
Copy Markdown
Owner

Fixes: #117 #316 #509 #577 #1091 #886

Thanks to the aptly-named @ideasman42 in #1091.

  -U, --context-lines <N>
          Display at most N context lines around each change.

          When the input diff has more context lines than N, delta will use all of them for syntax
          highlighting but only display N. This can fix incorrect syntax highlighting around
          multiline constructs (multiline strings, block comments, etc). Use this in conjunction
          with git's -U option, e.g. `git diff -U9999`.

@dandavison dandavison force-pushed the syntax-hl-context-fix branch from ad2fd45 to 180e396 Compare March 20, 2026 14:23
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

Successfully merging this pull request may close these issues.

Syntax highlighting sometimes incorrect with multiline constructs

1 participant