Skip to content

Fix #467: Paste as HTML collapses white spaces - #469

Merged
mickaelistria merged 1 commit into
eclipse-platform:masterfrom
mihnita:mihnita_fix_467
Dec 5, 2022
Merged

mickaelistria merged 1 commit into
eclipse-platform:masterfrom
mihnita:mihnita_fix_467

Conversation

@mihnita

@mihnita mihnita commented Nov 22, 2022 •

Copy link
Copy Markdown
Contributor

Tested on Win 11, MacOS Ventura 13.0.1, Debian 10.

Tested Gmail, Google Docs, Google Slides:

  • Win: Chrome & Firefox
  • Debian: Chrome & Firefox
  • MacOS: Chrome, Firefox, and Safari

Tested platform native apps:

  • MS Word 2000 and PowerPoint 2000 on Win
  • LibreOffice Writer (~Word / GDocs) and LibreOffice Impress (~PowerPoint / GSlides )
  • The Apple Mail, Notes, and TextEdit apps on MacOS (they come with the system)

Screenshots for everything here: https://mihai-nita.net/eclipse_swt_467/

@mihnita

mihnita commented Nov 22, 2022

Copy link
Copy Markdown
Contributor Author

Note: this depends on eclipse-jdt/eclipse.jdt.ui#320, otherwise copying code from the editor will not store HTML in clipboard.

Note: I know this is late. But copy HTML to clipboard did not exist before 2022-12, it is a new feature.
So this can't break some existing functionality
(OK, it can break copy as plain text and as RTF, but those changes are already in, not affected by this fix)

You can see screenshots for all the tests.

No case got worse, in most cases things improved, and in some cases they stayed the same.
It might be that the paste used the RTF form, but the application had no option to say "Paste as <clipboard_format>", so no way to tell (Apple-Notes-macos, Apple-TextEdit-macos)

I am preparing a summary of what cases where fixed and what cases were not.

@github-actions

github-actions Bot commented Nov 22, 2022 •

Copy link
Copy Markdown
Contributor

Test Results

     303 files       303 suites   6m 11s ⏱️
  4 047 tests   4 036 ✔️   8 💤 2 ❌ 1 🔥
12 068 runs  11 994 ✔️ 70 💤 3 ❌ 1 🔥

For more details on these failures and errors, see this check.

Results for commit 28c3f65.

♻️ This comment has been updated with latest results.

@mihnita

mihnita commented Nov 22, 2022 •

Copy link
Copy Markdown
Contributor Author
Case Indent Line height Empty line Comment
Apple-Mail-macos better better better
Apple-Notes-macos same (good) same (good) same (good) No option to paste special. So it might be RTF, or not.
Apple-TextEdit-macos same (good) same (good) same (good) No option to paste special. So it might be RTF, or not.
GDocs-Chrome-debian same (good) better better
GDocs-Chrome-macos same (good) better better
GDocs-Chrome-win better better better
GDocs-Firefox-debian same (good) better better
GDocs-Firefox-macos same (good) better better
GDocs-Firefox-win better better better
GDocs-Safari-macos better better better
Gmail-Chrome-debian better better better
Gmail-Chrome-win better better better
Gmail-Firefox-debian better better better
Gmail-Firefox-macos better better better
Gmail-Firefox-win better better better
Gmail-Safari-macos better better better
GSlides-Chrome-debian same (good) better better
GSlides-Chrome-macos same (good) better better
GSlides-Chrome-win better better better
GSlides-Firefox-debian same (good) better better
GSlides-Firefox-macos same (good) better better
GSlides-Firefox-win better better better
GSlides-Safari-macos better better better
LibreOfficeImpress-debian same (bad) same (bad) same (good)
LibreOfficeWriter-debian same (bad) same (bad) better
MSPowerPoint2000-win same (bad) better better
MSWord2000-win better better better
WordPad-win same (good) same (bad) better

Legend for the issues I tried to fix:

  • Indent: the indent looks good (several spaces not collapsed into one)
  • Line height: the space between lines is not too big (as close as possible to Eclipse)
  • Empty line: the empty line between package and public class is present

Legend for results:

  • better: was incorrect before the fix, and correct after (fixed)
  • same (good): was correct before the fix, and correct after
  • same (bad): was incorrect before the fix, and incorrect after

@mickaelistria mickaelistria added this to the 4.27 M1 milestone Nov 22, 2022
@iloveeclipse

Copy link
Copy Markdown
Member

Note: LibreOfficeWriter is same for me as without the patch (no indentation), also looking on your screenshots I don't see any improvement.

@mihnita

mihnita commented Nov 22, 2022

Copy link
Copy Markdown
Contributor Author

Note: LibreOfficeWriter is same for me as without the patch (no indentation), also looking on your screenshots I don't see any improvement.

Yes, this is also what I see. This is why the summary says "same (bad)" in the first 2 columns.
The only thing that seems to improve was the treatment of empty line (between package and class) in the Writer.
So I didn't claim any improvement there.
But there are a lot of cells saying "better"

My theory (right now) is that the LibreOffice support for HTML clipboard is poor.
I will try to copy paste from other tools that put HTML in clipboard (browser, VS Code), to see if it is any better.

But even without LibreOffice, I home that the improvements are worth landing?

@mihnita

mihnita commented Nov 22, 2022

Copy link
Copy Markdown
Contributor Author

I've checked LibreOffice with Java code copy-pasted from Chrome and Firefox from 3 different websites that had Java code with syntax highlighting, from Google Docs, Google Slides, GMail.
Also formatted text in LibreOffice Impress and Writer and copy-pasted in the same app, and between the 2 apps.

And to summarize: no HTML pasting worked when pasting in Impress, no matter where it came from. Didn't even preserve colors or fonts.
Most HTML pasting worked in Writer, but with bad indent. I pasted from Eclipse, and it looked very similar to all the others.

Copy from Writer, paste to Impress
All paste formats were bad, the only one looking good was RTF.
What Writer puts in the clipboard:

  • Flat 6.1 Text Document => pasted bad. color preserved, but only pasted the first line
  • RTF => everything good
  • HTML => bad (no style)
  • Unformatted text => as expected

Copy from Impress
What Impress puts in the clipboard:

  • Flat XML format (EditEngine ODF)
  • RTF => everything good
  • Unformatted text => as expected

So there is no way to test HTML.


TLDR: looks like the HTML clipboard support is relatively poor in LibreOffice.


I also realized that my argument above about "a lot of cells saying better" is not necessarily fair.
Most cases are in fact variations of browsers / OSes against GMail / GDocs / GSlides.
So we can probably reduce all to 3 lines for the 3 "applications", and it would be fair.

I didn't test all of them to make a point against LibreOffice, but to make sure they work.

@mickaelistria

Copy link
Copy Markdown
Contributor

This change seems quite good. Please add a commit that increases version by +0.0.1 and we'll try to have it merged early after 4.26 is released.

@mihnita

mihnita commented Nov 24, 2022

Copy link
Copy Markdown
Contributor Author

Thank you.

Is there a place where I can read about what goes in each Eclipse stage (Mx, RCx)?
Because all I'm familiar with is what the Wiki says: https://wiki.eclipse.org/Category:SimRel-2022-12
But from that it is unclear to me if bug fixes that don't change public APIs, go, and up to what stage.
If new features don't go in after RC1, and bug fixes don't go in after RC1, then nothing goes in :-)
I know that in reality "important bug fixes" would go in.
But different project have different rules for what's important enough to make it.

Anyway, would be good if I can get familiar with the rules, so that I don't waste people time asking for reviews on issues that don't have a chance to make it. Especially at the time when everybody is busy with the last weeks before the release.
(like I did with eclipse-jdt/eclipse.jdt.ui#320).
I want to help, not to be a nuisance :-)

Thank you very much,
Mihai

@akurtakov

Copy link
Copy Markdown
Member

@mihnita

mihnita commented Nov 24, 2022

Copy link
Copy Markdown
Contributor Author

Thanks,
Kind of sore of :-)

It still does not clarify much, as "project lead or PMC vote on the bug report" explains the process, but not the rules.
As in "what makes a bug important enough to escalate" to a PMC?
For example, is this a important enough to bother a PMC?
(I know that probably not, it's just an example. But that's the kind of guideline I was looking for)

But I know a bit more than before :-)

Thank you!
M.

@mickaelistria

Copy link
Copy Markdown
Contributor

Usually in RC phases, only the regressions compared to latest releases are considered as important enough.

@mihnita

mihnita commented Nov 24, 2022

Copy link
Copy Markdown
Contributor Author

Got you! Thanks!
M.

@mickaelistria
mickaelistria merged commit bac39d2 into eclipse-platform:master Dec 5, 2022
@mickaelistria

Copy link
Copy Markdown
Contributor

Thank you!

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.

4 participants