marimo-team / marimo

A reactive notebook for Python — run reproducible experiments, execute as a script, deploy as an app, and version with git.
https://marimo.io
Apache License 2.0
6.72k stars 237 forks source link

no undo for split cell #1408

Closed alefminus closed 2 months ago

alefminus commented 4 months ago

Describe the bug

  1. Split cell using the new (awesome) shortcut Ctrl+'
  2. Press Ctrl-Z

Nothing happens

Environment

{
  "marimo": "0.6.0",
  "OS": "Linux",
  "OS Version": "6.8.7-300.fc40.x86_64",
  "Processor": "",
  "Python Version": "3.12.3",
  "Binaries": {
    "Browser": "--",
    "Node": "v20.12.2"
  },
  "Requirements": {
    "click": "8.1.7",
    "importlib-resources": "missing",
    "jedi": "0.19.1",
    "markdown": "3.6",
    "pymdown-extensions": "10.8.1",
    "pygments": "2.18.0",
    "tomlkit": "0.12.5",
    "uvicorn": "0.29.0",
    "starlette": "0.37.2",
    "websocket": "missing",
    "typing-extensions": "4.11.0",
    "black": "24.4.2"
  }
}

Code to reproduce

Any cell.

mscolnick commented 4 months ago

Our undo (ctrl-z) functionality only works the cell editor. We can add a toast so that you can undo with a button click - and bind the Ctrl-Z to that button.

alefminus commented 4 months ago

That is a pretty confusing aspect. The different Ctrl-F behavior for instance, between being in cell focused and not focused (how do you call that mode? do you use mode terminology?)

Is it a purely implementation detail, i.e. would you like to have a shared undo stack or do you prefer separate stacks?

The toast would definitely be preferable to the current situation :)

Thanks,

Alon

On Sun, May 19, 2024 at 6:13 PM Myles Scolnick @.***> wrote:

Our undo (ctrl-z) functionality only works the cell editor. We can add a toast so that you can undo with a button click - and bind the Ctrl-Z to that button.

— Reply to this email directly, view it on GitHub https://github.com/marimo-team/marimo/issues/1408#issuecomment-2119271246, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYWFZPGX2DGLQDQ2OXGEDLTZDC6TNAVCNFSM6AAAAABH6AO2KGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMJZGI3TCMRUGY . You are receiving this because you authored the thread.Message ID: @.***>

-- Alon Levy Software Developer Greenvibe 054-2395317

akshayka commented 4 months ago

Thanks for reporting!

Is it a purely implementation detail, i.e. would you like to have a shared undo stack or do you prefer separate stacks?

We prefer separate stacks. Sometimes you want to undo all edits to a cell -- just hold Ctrl + z -- without worrying about crossing cell boundaries or bringing back cells you meant to delete.

We can also add a hotkey for undoing actions on the entire cell array, in addition to the toast.

wasimsandhu commented 2 months ago

Grabbing this one next 🙂

wasimsandhu commented 2 months ago

Forgot to test an edge case... if you split a cell, edit cell #1, and then click undo, it does not recreate the original cell's code.

Additionally, if the toast disappears, your chance to undo the split is gone.

mscolnick commented 2 months ago

Additionally, if the toast disappears, your chance to undo the split is gone.

I think this is fine. It hangs out for a while.

mscolnick commented 2 months ago

Fixed by https://github.com/marimo-team/marimo/pull/2018, thanks @wasimsandhu!