Skip to content

fix: Copy in TextDiffView may lost the last line #1044

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

Closed
wants to merge 1 commit into from

Conversation

gadfly3173
Copy link
Contributor

@gadfly3173 gadfly3173 commented Mar 3, 2025

Reproduce: Press Ctrl + A in TextDiffView and copy

love-linger added a commit that referenced this pull request Mar 3, 2025
…lines in text diff view (#1044)

Signed-off-by: leo <longshuang@msn.cn>
@love-linger
Copy link
Collaborator

I've pushed another fix for this issue. See commit 35ee4a4

@gadfly3173
Copy link
Contributor Author

image
I think that make the issue worse.

@love-linger
Copy link
Collaborator

Very strange.
image

@love-linger
Copy link
Collaborator

The reason of this issue is:

When clamp startIdx and endIdx to [0, lines.Count - 1], the endPosition.Column and startPosition.Column may no longer refer to the row corresponding to endIdx/startIdx

@love-linger
Copy link
Collaborator

I can not re-produce the issue shows in your picture.

@gadfly3173
Copy link
Contributor Author

Run from the code is fine, but the artifacts in CI seems not right.

@love-linger
Copy link
Collaborator

Try to use Copy context menu instead of hotkey Ctrl+C which sometimes did not work as expacted.

@gadfly3173
Copy link
Contributor Author

gadfly3173 commented Mar 3, 2025

Try to use Copy context menu instead of hotkey Ctrl+C which sometimes did not work as expacted.

With the CI artifacts, the copy in context menu also not right, that's weird. I'm using Deepin 23 with linux-x64

@love-linger
Copy link
Collaborator

I'll download it and try

@love-linger
Copy link
Collaborator

Strange. The package.win-x64.zip works as expacted on my PC.

@love-linger
Copy link
Collaborator

love-linger commented Mar 3, 2025

Please make sure you have downloaded the correct version:
image

@gadfly3173
Copy link
Contributor Author

I am sure that I downloaded linux-x64 from https://github.com/sourcegit-scm/sourcegit/actions/runs/13625760977, and run dotnet publish locally will also produce the effect shown in the picture.

@love-linger
Copy link
Collaborator

Can you debug this project now?

@gadfly3173
Copy link
Contributor Author

After I reinstalled the deb/copied the locally packaged files several times, it finally worked, and I had no idea what the problem was.

@gadfly3173 gadfly3173 closed this Mar 3, 2025
@gadfly3173 gadfly3173 deleted the fix/copy-text branch March 3, 2025 08:42
@gadfly3173
Copy link
Contributor Author

Currently, copy would append an extra empty line if more than one line is selected.

@love-linger
Copy link
Collaborator

Currently, copy would append an extra empty line if more than one line is selected.

It's because that for multiple lines selection, we use StringBuilder.AppendLine which will always add a line-ending character for each line.

@gadfly3173
Copy link
Contributor Author

I made #1049 to fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants