winmerge
winmerge copied to clipboard
"copy selected text only" - bug or feature?
Thanks a lot for your work!
First issue:
In previous versions (2.16.2.0 or 2.16.0.0) when I selected a line by double clicking it and then used the shortcut "alt + left arrow" the whole line was copied to the left.
In the current version (2.16.6.0) when I select a line by double clicking it and then use the shortcut "alt + left arrow" only the selected text is copied to the left.
Is it a bug or a feature? If it is a feature I really would like to have an option to copy full lines only. I know about triple click, but my workflow doesn't get used to it ;)
Second issue:
In the following case "b2" is copied to the left in front of the line "c1". I would have expected it to copy to a separate line. (it works as expected when I select the full row)
Should be this part of the code: https://github.com/WinMerge/winmerge/blob/98f1c722244667c426a864a179998e3b1f751359/Src/MergeEditView.cpp#L1841-L1889
So issue 1 would be to have an option to also use this part:
CWaitCursor waitstatus;
pDoc->ListCopy(srcPane, dstPane, currentDiff);
instead of this part:
int firstDiff, lastDiff, firstWordDiff, lastWordDiff;
GetFullySelectedDiffs(firstDiff, lastDiff, firstWordDiff, lastWordDiff);
if (firstDiff != -1 && lastDiff != -1)
{
CWaitCursor waitstatus;
pDoc->CopyMultipleList(srcPane, dstPane, firstDiff, lastDiff, firstWordDiff, lastWordDiff);
}
Column selection is not affected and could stay as it is.
First issue: Is it a bug or a feature
It is a feature. Are you double-clicking to select a difference? In that case, I recommend using Alt + Enter key. However, you can use Alt + Left / Right or Right key to merge the differences at the cursor position without selecting a difference.
Second issue: I could not reproduce the bug as follows:
Can you tell me if you find the conditions to reproduce?
Thanks for your reply.
First issue:
It is a feature.
Mh, I understand the use case and know there are workarounds. Any chance to make that optional by a setting (GUI or hidden). I would prefer to always copy whole lines regardless of selected text.
Second issue:
- Took me a while to spot the difference. You used this file on the left side:
1: a
2:
3: c1
4: d
I used this file instead: (your line 2 is missing here)
1: a
2: c1
3: d
- It is also important that the compare option Whitespaces is set to Ignore all. If it is Compare or Ignore changes it works like visible in your example (
b1 b2 b3
is copied), otherwise onlyb2
is copied.
First issue:
I am not aggressive about making it optional. Patches are welcome.
Second issue:
I was surprised at the result of the merge, but I don't think it's a very wrong result because the selected area doesn't contain line breaks.
First issue:
I thought of creating a pull request for that. Do you think it should be an option in the GUI or an hidden option in the registry. Could you point me to a similar pull request adding an option like this?
Second issue: Mh, you are right regarding the selection this could be interpreted as intentional behavior. Handle it as solved from my side.
If in GUI: Should it locate at the editors page? With a checkbox named: "Always copy full lines instead of selected text only"? Below "Preserve original EOL chars"?
Do you think it should be an option in the GUI or an hidden option in the registry.
If few people need this option, I'd like to make it a hidden option, but if it's more, you'd better add a checkbox to the Options dialog. I don't know whether many people need this option or not. I'll leave it to you.
Could you point me to a similar pull request adding an option like this?
The following commits will be helpful.
https://github.com/WinMerge/winmerge/commit/a7a8e90ac14c0b4cd0cd60208e5790a7f2dd62eb
If in GUI: Should it locate at the editors page?
No problem to add the checkbox into the Editor page.
With a checkbox named: "Always copy full lines instead of selected text only"? Below "Preserve original EOL chars"?
I'm not good at English so I can't come up with a better checkbox name.
I hope you name the checkbox, noting that this feature does not copy the selected text, but copies the selected character level differences.
7 months later, added a pull request #459 for this issue. With a hidden option, details there.