Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Diff context size doesn't decrease to 0 #4012

Open
dotfrag opened this issue Oct 25, 2024 · 1 comment
Open

Diff context size doesn't decrease to 0 #4012

dotfrag opened this issue Oct 25, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@dotfrag
Copy link

dotfrag commented Oct 25, 2024

Describe the bug
When using { to decrease diff context, the lowest values it goes to is 1. Git (and delta) supports 0.

To Reproduce
Steps to reproduce the behavior:

  1. Go to any diff mode view (i.e. Commits panel)
  2. Press {
  3. Lowest possible diff context is 1.

Expected behavior
I expect the size the be able to reach 0.

Screenshots
Unnecessary.

Version info:
Run lazygit --version and paste the result here

commit=v0.44.1, build date=2024-09-18T13:19:48Z, build source=binaryRelease, version=0.44.1, os=linux, arch=amd64, git version=2.47.0

Run git --version and paste the result here

git version 2.47.0

Additional context
N/A.

@dotfrag dotfrag added the bug Something isn't working label Oct 25, 2024
@dotfrag
Copy link
Author

dotfrag commented Oct 25, 2024

Had a quick look at the code I believe this needs to be changed to 0:

if self.isShowingDiff() && old_size > 1 {

jesseduffield added a commit that referenced this issue Nov 18, 2024
- **PR Description**

Per #4012, the diff context size should be able to be decreased to zero.
I update the type def for DiffContextSize to be an unsigned integer and
add saturated add and subtraction in `context_lines_controller.go` where
the variable is updated (++ or --)

- **Please check if the PR fulfills these requirements**

* [x] Cheatsheets are up-to-date (run `go generate ./...`)
* [x] Code has been formatted (see
[here](https://github.com/jesseduffield/lazygit/blob/master/CONTRIBUTING.md#code-formatting))
* [x] Tests have been added/updated (see
[here](https://github.com/jesseduffield/lazygit/blob/master/pkg/integration/README.md)
for the integration test guide)
* [x] Text is internationalised (see
[here](https://github.com/jesseduffield/lazygit/blob/master/CONTRIBUTING.md#internationalisation))
* [x] If a new UserConfig entry was added, make sure it can be
hot-reloaded (see
[here](https://github.com/jesseduffield/lazygit/blob/master/docs/dev/Codebase_Guide.md#using-userconfig))
* [x] Docs have been updated if necessary
* [x] You've read through your own file changes for silly mistakes etc

<!--
Be sure to name your PR with an imperative e.g. 'Add worktrees view'
see https://github.com/jesseduffield/lazygit/releases/tag/v0.40.0 for
examples
-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant