Bug 449732 - When copying text from the merge output, copying tabs copies the wrong region of text
Summary: When copying text from the merge output, copying tabs copies the wrong region...
Status: RESOLVED FIXED
Alias: None
Product: kdiff3
Classification: Applications
Component: application (show other bugs)
Version: 1.9.4
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: michael
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-02-07 05:42 UTC by nyanpasu64
Modified: 2023-05-19 14:41 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
Two text files with tabs in them, demonstrating the bug. (171 bytes, application/x-7z-compressed)
2022-02-07 05:42 UTC, nyanpasu64
Details

Note You need to log in before you can comment on or make changes to this bug.
Description nyanpasu64 2022-02-07 05:42:59 UTC
Created attachment 146376 [details]
Two text files with tabs in them, demonstrating the bug.

SUMMARY
If I merge two files with tabs in them, and (in the merge output pane) select and text containing tabs, the copied region is shorter and earlier than the text selected.

STEPS TO REPRODUCE
1. To match my observed results, set kdiff3's tab width to 4.
2. Download and extract the attachment, and run `kdiff3 -m a b`. Alternatively run kdiff3, open a and b, then trigger a merge.
3. Resolve the merge conflict by selecting both A and B. 
4. In the output pane, select "\t\tasdfasdf" and copy it. (Alternatively try copying "asdfasdf" for different results.)

This bug does not occur when copying from the input file panes.

OBSERVED RESULT
The clipboard contains "\t\tas". kdiff3 sees that we have 10 physical characters (two tabs followed by 8 alphabetical), but wrongly copies 10 visual characters instead (two tabs of width 4, followed by 2 alphabetical).

If you copied "asdfasdf", kdiff3 sees that we want to copy physical characters 2 through 10, and wrongly copies visual characters 2 through 10 (dropping the second half of the first \t from 0 through 4, copying the second \t from 4 through 8, then copying the first "as" from 8 through 10).

EXPECTED RESULT
The clipboard contains "\t\tasdfasdf" or the text we have selected.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux
KDE Plasma Version: 5.23.90
KDE Frameworks Version: 5.90.0
Qt Version: 5.15.2
Kernel Version: 5.16.4-zen1-1-zen (64-bit)
Graphics Platform: X11
Processors: 12 × AMD Ryzen 5 5600X 6-Core Processor
Memory: 15.6 GiB of RAM
Graphics Processor: NVIDIA GeForce GT 730/PCIe/SSE2

ADDITIONAL INFORMATION
Comment 1 nyanpasu64 2023-05-19 14:41:08 UTC
Appears fixed in 1.10.4. Not sure when.