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

Linematch, diffopt, and diffget/put not working as expected. #22696

Open
SeniorMars opened this issue Mar 16, 2023 · 2 comments
Open

Linematch, diffopt, and diffget/put not working as expected. #22696

SeniorMars opened this issue Mar 16, 2023 · 2 comments
Labels
bug issues reporting wrong behavior diff
Milestone

Comments

@SeniorMars
Copy link
Sponsor

SeniorMars commented Mar 16, 2023

Problem

Linematch and diffget do not work correctly together. I use diffget to resolve merge conflicts, and with this new diffopt option, I'm not getting the expected behavior.

Since merging is a complicated mess, I tried to record what I mean in a 17second gif:

not working as I expected

Steps to reproduce

Generally:

  1. Have a merge conflict and start with nvim -d
  2. Set diffopt+=linematch:50
  3. Try to use :diffget <buffer num/name>

I see that diffget does not resolve a merge conflict as I expected.

Expected behavior

With the default options of diffopt, using diffget with nvim -d, I can resolve merge conflicts, but not with linematch appened to diffopt.

Neovim version (nvim -v)

NVIM v0.9.0-dev-2446+g995196c61-dirty

Vim (not Nvim) behaves the same?

No, as linematch is not implmented yet: vim/vim#9661

Operating system/version

macOS 13.2.1

Terminal name/version

kitty

$TERM environment variable

xterm-kitty

Installation

brew

related to #14537 and perhaps #20931

@SeniorMars SeniorMars added the bug issues reporting wrong behavior label Mar 16, 2023
@SeniorMars SeniorMars changed the title Linematch, diffopt, and diffput Linematch, diffopt, and diffput not working as expected. Mar 16, 2023
@zeertzjq zeertzjq added the diff label Mar 17, 2023
@zeertzjq zeertzjq added this to the 0.9 milestone Mar 17, 2023
@SeniorMars SeniorMars changed the title Linematch, diffopt, and diffput not working as expected. Linematch, diffopt, and diffget/put not working as expected. Mar 17, 2023
@lewis6991
Copy link
Member

@jwhite510. Do you know why this might be?

@bfredl bfredl modified the milestones: 0.9, 0.10 Apr 7, 2023
@jwhite510
Copy link
Contributor

@SeniorMars
@lewis6991
Sorry, I did not see this until now

linematch with diffget looks like it's working as I'd expect.

As the differences are more granular, the 'diffget' and 'diffput' operations
behave accordingly.

The difference when it comes to 'diffget' and 'diffput' operations is that this
conflict is no longer treated as a single diff, it is now 6 diffs, stacked on
top of each other

  BUFFER 1   BUFFER 2   BUFFER 3  BUFFER 4
----------------------------------------------
           |           |       |<<<<<< HEAD     DIFF 1
-----------|-----------|-------|--------------
rabbits    |           |       |rabbits         DIFF 2
lions      |           |       |lions
-----------|-----------|-------|--------------
salamanders|salamanders|       |salamanders     DIFF 3
-----------|-----------|-------|--------------
           |           |       |======          DIFF 4
-----------|-----------|-------|--------------
           |           |Monkeys|Monkeys         DIFF 5
-----------|-----------|-------|--------------
	   |           |       | >>>>>> monkey  DIFF 6
----------------------------------------------

when you have the cursor in buffer 4 and call a :diffget from buffer 3, it is getting
it, and it is non existent, so you see that just the '<<<<< HEAD' is erased.

I believe the behaviour you are looking for can be obtained by first visually
selecting the entire conflict (buffer 4 in my diagram), and then typing
:diffget buffer 3

like this:

:'<,'>diffget ...

so that diffget will be applied to each diff (all 6) in the visual selection

when you disable linematch, the entire thing is one diff, and diffget will get
the whole content because it is just one diff, you don't have to visually
select it

chewcw added a commit to chewcw/dtfs that referenced this issue Nov 10, 2023
because of this issue for the nvimdiff neovim/neovim#22696
@dundargoc dundargoc modified the milestones: 0.10, backlog Mar 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug issues reporting wrong behavior diff
Projects
None yet
Development

No branches or pull requests

6 participants