gitui-org / gitui-org/gitui

Only show line-break visualization if the surrounding lines are not also newly added/removed

Open
#1,923 0 comments 0 reactions 0 assignees View on GitHub
feature-request
Dominant language
Rust
Stars
22.5k
Forks
773
PR merge metrics
No merged PRs in 30d

Description

**Is your feature request related to a problem? Please describe.**
With v0.24, a new feature was added where empty lines are always rendered as `¶`. When adding a new file or a big chunk of code, this doesn't add much value and is very distracting.

**Describe the solution you'd like**
When viewing a diff, only show the line-break visualization on lines that aren't in the middle of a diff chunk but instead only on lines where it wouldn't otherwise be clear that a newline was added/removed.

For example:
```diff
line 1

+line 1.5
+
line 2
```

This is currently shown as:
```diff
line 1

+line 1.5

line 2
```

Instead, I'd prefer if this was shown like this:
```diff
line 1

+line 1.5

line 2
```

The `+` characters shown here are only for visualization purposes, because `diff` code blocks don't show color highlighting otherwise.

A larger example (note no `¶` between `line d` and `line e`):
```diff
line a1
line a2

line b

-line c1
-line c2
-
-line d

line e

+line f
```

This would mean that newly added or removed files would not contain any `¶` markers (unless on the very first or last line), which makes reading them a lot easir.

**Describe alternatives you've considered**
PR #1904 allows disabling line-break visualizations altogether which restores the behavior from v0.23.

Alternatively, a single space with a red or green background could be shown on lines where whitespace or an empty line is added or remove.

**Additional context**
This is related to #1894 and PR #1904 which requests turning off the newline visualization alltogether.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.