Diff tool should insert code difference, for example, when SHIFT key is pressed

Андрей Шенец 4 years ago updated by k h 4 years ago 5

Right now when you compare changes in two panel diff tool, or three panel diff tool you can got case when diff tool allows you only to replace code. It can happen when in two branches the same line of code has been changed and you are trying to merge these files.

It would be great to have possibility to force diff tool to insert diff line if SHIFT key is pressed.

Where it should be inserted - above or below the other side's block?

SHIFT = insert above, CTRL = insert below

I think when you copy from the left then above when copy from the right then below. In any case usually when you do such insertion you edit code after it.

If you already have to edit the code, why not use copy-paste now to get the achieved effect?

Because usually is not always.

You can have following usual cases:

1. The diff tool determined that code changed, but in general in two different branches code was added to the same place. For example in conflict solver in this case you need copy code from the left and copy code from the right. And with copy-paste it is selecting code on the left pasting on the middle, selecting code on the right pasting on the middle.

2. In one branch code was edited in the second was added and the diff tool thinks that in both cases it is edited. In this case you usually need to copy code from the one of the panels.

3. When you have complex conflict and you need to merge code manually. You can go by two way. The first one is to use currently implemented replace from any panel and then manually copy-paste and replace or type it youself but it is usually much easier to include both conflict parts and just delete unnecessary code.

Also using of mouse or selecting code with keyboard is quite long action and it is not handy. It is much easier to just press alt + shift + left arrow (for example) or shift + click.