Skip to content

Clipboard copy notebook cell output doesn't doesn't work properly with multiple display() calls #247010

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

Open
RossBencina opened this issue Apr 20, 2025 · 0 comments
Assignees

Comments

@RossBencina
Copy link

Does this issue occur when all extensions are disabled?: No (Requires Jupyter extension)

  • VS Code Version:
    Version: 1.99.3 (user setup)
    Commit: 17baf84
    Date: 2025-04-15T23:18:46.076Z
    Electron: 34.3.2
    ElectronBuildId: 11161073
    Chromium: 132.0.6834.210
    Node.js: 20.18.3
    V8: 13.2.152.41-electron.0
    OS: Windows_NT x64 10.0.19045
  • Jupyter extension version:
    Identifier ms-toolsai.jupyter
    Version 2025.3.0
    Last Updated 2025-04-19, 20:21:58
  • OS Version:
    Windows 10 2H22 April patch level

Steps to Reproduce:

  1. Create an .ipynb notebook (or open an existing one)
  2. In a new cell, enter the following code, then run the cell.
for i in range(5):
    display(i)

The cell output displays

0
1
2
3
4

Bug 1:

Right-click in the output cell area, e.g. on 4, and select "Copy Cell Output". Open notepad and paste the text. Expected behavior of paste (i.e. clipboard text contents): entire cell output 0 1 2 3 4 each number on a separate line, or all selected text if there is a text selection, actual behavior: only 4 was cut and pasted.

Bug 2:

Use the mouse to select all of the text in the cell output (i.e. select 0 through 4). Type Ctrl-C. Open notepad and paste the text. Expected behavior of paste (i.e. clipboard text contents): selected cell output 0 1 2 3 4 each number on a separate line, actual behavior: 01234 all numbers smooshed together on one line.


I think you need to go back to the drawing board and work out how to make text selection and clipboard copy in output cells work properly. The Ctrl-C behavior seems to work properly (sometimes) when you make a text selection within a contiguous region of output text, but this is not consistent with the right-click menu, and there is not an easy way to copy the entire cell output by selecting with the mouse because it is really hard to select just the output without also selecting some of the code cell.

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

No branches or pull requests

2 participants