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

Copy as Text and paste to other will be in confusion #1392

Closed
mengxin523 opened this issue May 10, 2024 · 23 comments · Fixed by #1394, #1396 or #1397
Closed

Copy as Text and paste to other will be in confusion #1392

mengxin523 opened this issue May 10, 2024 · 23 comments · Fixed by #1394, #1396 or #1397
Assignees
Labels
bug Something isn't working high-priority High Priority released Available in a released installer

Comments

@mengxin523
Copy link

Hello,
When I use the mode of copying as text and pasting it elsewhere, I will find that the top and bottom lines of the text will automatically add carriage returns, resulting in confusion when pasting to the target and producing unexpected results
eg:
I just copy the text: RSXMB_AGG_XPI_ADMIN
and paste to else where:
ShareX-2024-05-10 16-52-17 2453
I select the first line and paste, but it will display in the second line!
ShareX-2024-05-10 16-53-20 2454

@mengxin523 mengxin523 added bug Something isn't working unread I have seen it or had time to refine it yet labels May 10, 2024
@stevencohn stevencohn removed the unread I have seen it or had time to refine it yet label May 10, 2024
@stevencohn
Copy link
Owner

Hello. From your screenshots above, it looks like you've selected those extra lines. But I can reproduce that it will add an extra line before the content that I've selected when selecting only one line. I'll look into that.

Alternately, you should be able to just use Ctrl+C to copy the content and paste into Excel, unless there is styling (bold, italic, color) that you do not want to copy over.

@mengxin523
Copy link
Author

Hello. From your screenshots above, it looks like you've selected those extra lines. But I can reproduce that it will add an extra line before the content that I've selected when selecting only one line. I'll look into that.

Alternately, you should be able to just use Ctrl+C to copy the content and paste into Excel, unless there is styling (bold, italic, color) that you do not want to copy over.

No, I'm pretty sure I just selected the text and copied it, and inside the picture is the pasted result, with an Enter line before and after it,I am setting copy as text with the shortcut Ctrl+C
This problem is very difficult to use, please deal with it, thank you

@mengxin523
Copy link
Author

I wish to filter out the carriage returns above and below lines, otherwise pasting to a single text box will not paste, and pasting to Excel will produce the wrong line
Thank you

@mengxin523
Copy link
Author

ShareX-2024-05-11 09-13-24 2475

SEE

@stevencohn
Copy link
Owner

stevencohn commented May 11, 2024

I found a problem where Copy As Text would enter an extra blank line before the text. There should be no extra line after the text. Your first picture shows that you selected the lines both prior and after your text.

The fix should avoid anything other than what you've selected.

@stevencohn stevencohn added released Available in a released installer and removed next-release Addressed but not yet released labels May 11, 2024
@mengxin523
Copy link
Author

I updated the latest version and found that now when pasting, the carriage return on the first line has been removed, which is good. But the text will be automatically followed by a carriage return!! Hope to remove them all!

@mengxin523
Copy link
Author

ShareX-2024-05-12 00-44-53 2505
SEE

@stevencohn stevencohn reopened this May 11, 2024
@stevencohn stevencohn added high-priority High Priority and removed released Available in a released installer labels May 11, 2024
stevencohn added a commit that referenced this issue May 12, 2024
stevencohn added a commit that referenced this issue May 12, 2024
@stevencohn stevencohn linked a pull request May 12, 2024 that will close this issue
@stevencohn
Copy link
Owner

The next release will have a couple of minor adjustments to Copy as Text. However, it's not going to do exactly what you need at all times for two reasons. First, the command must be fit for purpose for the majority of users and not specialized for specific use cases. Second, there are limitations in what OneMore can "see" on a OneNote page.

For example, the following two selections appear identical to OneMore. There is no way to determine whether the user has selected the end of line character so Copy as Text must treat them the same - as if the end of line is selected.

image

But it does fix mid-sentence selections:

image

will result in just the word "sentence" selected without a newline.

@stevencohn stevencohn added the next-release Addressed but not yet released label May 12, 2024
stevencohn added a commit that referenced this issue May 12, 2024
@mengxin523
Copy link
Author

Sometimes we copy a Shell command from OneNote to the Linux terminal, but if you automatically add an extra Enter line after the copy content, it will cause the command to be automatically executed after the copy is finished, which is very serious. Because copied commands often need to be slightly modified in the linux terminal to execute!
And every time I choose the text very carefully, try not to have a selection space after it, but unfortunately, pasting to the target will still be added with an extra Enter line!
I'm in favor of automatically adding an extra Enter line if the selected text is followed by a space, after all, users will copy multiple lines of text!

@mengxin523
Copy link
Author

And if only the text is selected, not the final space, the copy function of the OneNote standard does not add any additional Enter lines; If the last space is selected, an Enter line is automatically added after it

@mengxin523
Copy link
Author

mengxin523 commented May 13, 2024

ShareX
Automatically adds an Enter line after linux commands, causing the pasted commands to run automatically before editing

@stevencohn
Copy link
Owner

Then you should keep Ctrl+C as the built-in functionality and only use OneMore's Copy as Text when you want to avoid copying styles to applications that know about styles. Copying to a terminal should not copy styles so the built-in system Ctrl+C is what you want to use. You can often "paste as text" into various applications that know about such things as well.

@stevencohn
Copy link
Owner

And if only the text is selected, not the final space, the copy function of the OneNote standard does not add any additional Enter lines; If the last space is selected, an Enter line is automatically added after it

I understand. But OneMore doesn't have access to the OneNote internals so can't tell the difference unfortunately.

@mengxin523
Copy link
Author

Then you should keep Ctrl+C as the built-in functionality and only use OneMore's Copy as Text when you want to avoid copying styles to applications that know about styles. Copying to a terminal should not copy styles so the built-in system Ctrl+C is what you want to use. You can often "paste as text" into various applications that know about such things as well.

I don't have much need to copy OneNote styles and paste them elsewhere, I usually just copy the text out and don't need styles

@stevencohn
Copy link
Owner

When you copy content (either using Copy as Text or using the system Ctrl+C) it will create multiple copies of the content on the clipboard in various formats. If the content is text-based then, no matter which app, it will always add a raw text format.

Copying to a shell window will not copy the styles; it will copy the raw text.
To copy to Excel, you can use the Alt-H-V-M (Paste matching destination formatting)

Those are your workarounds while I consider whether the changes make sense for the majority of use cases. I understand your cases are important to you and I appreciate that. But I have to consider everyone and what their use cases are and have been. Thank you for your input.

Repository owner deleted a comment from stevenmcohn May 13, 2024
@mengxin523
Copy link
Author

I think it is important to note that this function is called copy as text, itself is copied text, there is no style!

@stevencohn
Copy link
Owner

stevencohn commented May 13, 2024

It exists to grab just the text when there are styles, lists or tables. As explained here, "Copies the page or the selected content as plain text." For example, given this selection:

image

Will result in text that looks like this:

Lorem ipsum dolor sit amet
* consectetur adipiscing elit
* sed do eiusmod tempor incididunt

        ut labore et aliqua     dolore magna
        Ut enim ad minim veniam Ut enim ad minim veniam

And, importantly, even though there are styles, it will not add formats to the system clipboard containing those styles. Even if you paste into MS Word, it will just be text. Compare this to Ctrl+C which adds all the following formats to the clipboard for other apps to consume: [[OneNote 2016 Internal, HTML Format, System.String, UnicodeText, Text, EnhancedMetafile, DeviceIndependentBitmap]]

@stevencohn
Copy link
Owner

stevencohn commented May 13, 2024

I am going to make some adjustments. This likely suites your needs.

Note that this may cause others use cases to not exactly align with expectations. But, due to the lack of information from the OneNote APIs, OneMore simply can't cover all use-cases in intuitive ways, so some concessions are unavoidable.

stevencohn added a commit that referenced this issue May 13, 2024
stevencohn added a commit that referenced this issue May 13, 2024
@stevencohn stevencohn linked a pull request May 13, 2024 that will close this issue
@mengxin523
Copy link
Author

Oh Thanks !
The reason why I particularly need this Copy as text function is mainly because the content copied from the OneNote standard will become an image when pasted elsewhere, and OneMore also has a function called Copy as MarkDown, which in my opinion should contain style

@mengxin523
Copy link
Author

ShareX-2024-05-15 17-54-16 2551
NEW ISSUE
Text in the table ,and Copy as text will not work fine!

@stevencohn
Copy link
Owner

This is fixed along with the work that will be released in the next version. The next version is not yet available.

weissm pushed a commit to weissm/OneMore that referenced this issue May 25, 2024
@stevencohn stevencohn added released Available in a released installer and removed next-release Addressed but not yet released labels May 26, 2024
@mengxin523
Copy link
Author

I found that if the text in the table is copied, there will be a delay before it is pasted into other places. It will take several seconds before the pasted content is available. Before that, it is always the old content

@stevencohn
Copy link
Owner

If the table is quite large, ostensibly any OneMore operation can be slow. Typically, reading a large page is quick for most operations. But tables make the page much more complex since OneNote presents it to OneMore as verbose XML.

Writing to a large page, updating a large page, especially pages containing very large containers with complex tables and indents and drastically slow down due to the way the OneNote APIs work. This is a known problem and I've reported it to Microsoft but it doesn't seem to be anywhere on their priority list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working high-priority High Priority released Available in a released installer
Projects
None yet
2 participants