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

Text truncated on copy with "..." ellipsis #1540

Closed
pombredanne opened this issue Aug 8, 2019 · 15 comments
Closed

Text truncated on copy with "..." ellipsis #1540

pombredanne opened this issue Aug 8, 2019 · 15 comments
Labels

Comments

@pombredanne
Copy link

pombredanne commented Aug 8, 2019

monaco-editor version: See below
Browser: Firefox 68.0.1 (64-bit)
OS: Linux

Steps or JS usage snippet reproducing the issue:

Copy some long enough text ... and paste it: it gets truncated in the middle with dot dot dot ellipsis. On Chrome this is not truncated. Only on FF.

This seems to be closely related to #1458

This is the version used in ClearlyDefined: https://clearlydefined.io/vs/editor/editor.main.js

/*!-----------------------------------------------------------
 * Copyright (c) Microsoft Corporation. All rights reserved.
 * Version: 0.10.1(ebbf400719be21761361804bf63fb3916e64a845)
 * Released under the MIT license
 * https://github.com/Microsoft/vscode/blob/master/LICENSE.txt
 *-----------------------------------------------------------*/

This is the version used in Azure: https://cdn.vsassets.io/3rdParty/_content/Extensions/CodeEditor/0.13.1.1/vs/editor/editor.main.js

/*!-----------------------------------------------------------
 * Copyright (c) Microsoft Corporation. All rights reserved.
 * Version: 0.13.2(53a4043676e6259fb734c90fad14bf16f7425640)
 * Released under the MIT license
 * https://github.com/Microsoft/vscode/blob/master/LICENSE.txt
 *-----------------------------------------------------------*/
@pombredanne
Copy link
Author

Note that this is still an issue in v 0.17.0

@pombredanne
Copy link
Author

pombredanne commented Aug 9, 2019

Note the we litterally have an Ellipsis codepoint https://en.wikipedia.org/wiki/Ellipsis not a dotdotdot

@pombredanne
Copy link
Author

@alexandrudima as the main author, would you by chance have an idea of where to look for in the code to fix this?

Thank you in advance!

This is a pending bug in clearlydefined/website#799 which happens to be sponsored and used also by MSFT and GH FWIW.

And that same issue exists in Azure pipelines when viewing logs: you cannot copy them... the copy is truncated.

@alexdima alexdima added the linux label Dec 11, 2019
@alexdima
Copy link
Member

Currently the selection clipboard is not supported in linux. Let's track in #1458

@pombredanne
Copy link
Author

@alexdima you wrote:

Currently the selection clipboard is not supported in linux. Let's track in #1458

I am not sure I get what you mean: can you elaborate a bit?
Thanks!

@pombredanne
Copy link
Author

Also this ticket is about Firefox on Linux. There is no issue on Chrome for this. So this is browser specific and not only Linux. #1458 is about Chrome and I cannot reproduce the issue at play here in Chrome.
Do you mind to reopen this ticket?

@alexdima
Copy link
Member

alexdima commented Dec 12, 2019

@pombredanne Here is where we write ellipsis to the hidden <textarea>: https://github.com/microsoft/vscode/blob/cc1ba3c0215af60ad3574baaa3223c9f1875d964/src/vs/editor/browser/controller/textAreaState.ts#L240-L287

That is the text that is placed in the hidden <textarea> that we use for input. We cannot place in there a large body of text because browsers are too slow. That text (from the <textarea>) makes it to the Linux selection clipboard AFAIK. That is to say if Ctrl+C is used, we write the full selected text to the clipboard event.

Can you please clarify your steps? How do you copy the text and paste it in the sentence: "Copy some long enough text ... and paste it"

Are you using:

  • selection clipboard + middle mouse click
  • Ctrl+C and Ctrl+V
  • right click copy and Ctrl+V
    etc.

@pombredanne
Copy link
Author

@alexdima here is the sequence of events on Firefox 70.0.1 (64-bit) on Ubuntu 16.04 LTS:

  1. click to focus inside the editor
  2. press Shift key, keep pressed
  3. then press Arrow down key to select lines. Select lines until the text scrolls by at least one line (e.g. meaning the selection is larger than what can be seen on screen)
  4. release Shift and Arrow down keys
  5. Press Ctrl+C
  6. Go elsewhere with Alt+Tab to open some text editor, press Ctrl+V

With this sequence, the pasted text is truncated and there is a ellipsis instead on the last line of the pasted text.

For 5. I can use instead (right click or Shift+F10) + copy from the pop-up menu and Ctrl+V or paste to get the same results. Same if I use FF main menu edit/copy option.

I am not using the selection clipboard nor middle mouse click (in fact this is an X "feature" that is disabled in most Linux desktop these days AFAIK and disabled on mine by default).

@alexdima
Copy link
Member

@pombredanne I cannot reproduce. I have tried:

I have tried with Firefox 70.0.1 (64-bit) on Ubuntu 19.10

@pombredanne
Copy link
Author

Doing the same thing I get this paste:

/* Game of Life
 * Implemented in TypeScript
 * To learn more about TypeScript, please visit http://www.typescriptlang.org/
 */
 
module Conway {

	export class Cell {
		public row: number;
		public col: number;
…	}
}

var game = new Conway.GameOfLife();

@pombredanne
Copy link
Author

We can have a screen sharing session at your convenience if that can help you debug this.

@alexdima
Copy link
Member

alexdima commented Dec 12, 2019

@pombredanne Have you customized your FF profile in any way, such as to disable clipboard APIs? Can you please first attempt to reproduce with a clean FF profile and without any extensions? Does this reproduce for you on Chromium on the same machine?

Can you reproduce in the page at https://vscode-web-test-playground.azurewebsites.net/ (that one has a more up-to-date version of the editor).

@alexdima
Copy link
Member

Can you also please try running the following fiddle -- https://jsfiddle.net/4mv1wrab/

  • open dev tools
  • click inside the textarea and make a selection
  • press ctrl+c
  • let me know what the console says and what the clipboard contains.

For me, the console says setting text via e.clipboardData and the clipboard contains some other text 1

Thank you!

@pombredanne
Copy link
Author

@alexdima you nailed it and I am very sorry for having wasted your time here.

The culprit are my settings. I have checked my config and found that the setting dom.event.clipboardevents.enabled was set to False to avoid clipboard hijacking from malicious websites. If I enable it, the copy/paste works OK in the fiddle and everywhere.

Things works also fine as-is in Chrome and Chromium.

Please accept my apologies and thank you for your patience!

@alexdima
Copy link
Member

No problem, glad I could help.

@vscodebot vscodebot bot locked and limited conversation to collaborators Jan 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants