microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.95k stars 29.53k forks source link

ctrl-Z deletes instead of restores! #150145

Closed krahnikblis closed 2 years ago

krahnikblis commented 2 years ago

Issue Type: Bug

somehow, randomly, ctrl-Z in VS Code with a jupyter notebook file deletes a cell!?!?! why??? and then ctrl-z to try to un-delete, just deletes yet another cell??? is this funny to someone? like "haha they can put a man on the moon but they can't un-delete python cells!"

expected result: the ONLY thing that deletes a cell is clicking the "trash" icon that deletes a cell. ONLY, because "delete" is not even in the right-click menu (so why should it be an undocumented keyboard shortcut?).

i tried all the wizardry in those threads, like deselect a cell and click esc or just z, wiggle my big toe and run "_ih[negative nonsense colon]" - all those things do is delete more cells too. this is as enhanced as my calm can be after losing hours of work.

VS Code version: Code 1.67.1 (da15b6fd3ef856477bf6f4fb29ba1b7af717770d, 2022-05-06T12:37:03.389Z) OS version: Windows_NT x64 10.0.22000 Restricted Mode: No

System Info |Item|Value| |---|---| |CPUs|AMD Ryzen 9 3900XT 12-Core Processor (24 x 3793)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled| |Load (avg)|undefined| |Memory (System)|31.93GB (14.45GB free)| |Process Argv|--crash-reporter-id f068710a-abae-418b-80bf-c9cbb94e10fd| |Screen Reader|no| |VM|0%|
Extensions (8) Extension|Author (truncated)|Version ---|---|--- pinescript|Jey|3.0.1 vscode-docker|ms-|1.22.0 python|ms-|2022.6.2 vscode-pylance|ms-|2022.5.2 jupyter|ms-|2022.4.1021342353 jupyter-keymap|ms-|1.0.0 jupyter-renderers|ms-|1.0.6 remote-containers|ms-|0.234.0
vscodenpa commented 2 years ago

Thanks for creating this issue! It looks like you may be using an old version of VS Code, the latest stable release is 1.67.2. Please try upgrading to the latest version and checking whether this issue remains.

Happy Coding!

vscodenpa commented 2 years ago

We closed this issue because it is a question about using VS Code rather than an issue or feature request. Please search for help on StackOverflow, where the community has already answered thousands of similar questions. You may find their guide on asking a new question helpful if your question has not already been asked. See also our issue reporting guidelines.

Happy Coding!

rebornix commented 2 years ago

Thanks for your feedback! Notebook editor is currently fully integrated with the rest of the VS Code workbench, including ctrl+z, ctrl+shift+z, ctrl+f, etc.

To move off this feature, you can add following snippet in your keybindings.json to ensure that ctrl+z doens't undo in the notebook at all

{
        "key": "ctrl+z",
        "command": "-undo",
        "when": "notebookEditorFocused"
    }

I'll continue to keep an eye on similar issues to see if we need to introduce a setting or update the keybindings in Jupyter to support disabling this.

AbhilashReddyM commented 2 years ago

This has affected me as well. I think ctrl-z should not be deleting cells. It is unexpected behavior. I noticed cells going missing a number of times while working in my notebooks. I am pressing ctrl-z to undo something I have typed and somehow inadvertently losing cells with content.