Skip to content

fix(word_diff): "No newline at eof" should show once for single hunk#1477

Merged
lewis6991 merged 1 commit intolewis6991:mainfrom
phanen:nonl2
Feb 10, 2026
Merged

fix(word_diff): "No newline at eof" should show once for single hunk#1477
lewis6991 merged 1 commit intolewis6991:mainfrom
phanen:nonl2

Conversation

@phanen
Copy link
Contributor

@phanen phanen commented Feb 10, 2026

Problem:
When use require('gitsigns.diff_int').run_diff I find
"no_nl_at_eof=true" can be set for both removed/added hunk, this make
"\ No newline at eof" appear multiple times.

Solution:

  • Only show no_nl_at_eof when it changed, remove uselss +/- prefix.
  • Also insert no_nl_at_eof after insert word diff to hls array
    to avoid messup the hls[] array index.

Problem:
When use `require('gitsigns.diff_int').run_diff` I find
"no_nl_at_eof=true" can be set for both removed/added hunk, this make
"\ No newline at eof" appear multiple times.

Solution:
* Only show no_nl_at_eof when it changed, remove uselss +/- prefix.
* Also insert no_nl_at_eof after insert word diff to hls array
to avoid messup the hls[] array index.
@phanen phanen marked this pull request as ready for review February 10, 2026 17:48
@lewis6991 lewis6991 merged commit 3121727 into lewis6991:main Feb 10, 2026
7 checks passed
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.

2 participants