marimo icon indicating copy to clipboard operation
marimo copied to clipboard

no undo for split cell

Open alefminus opened this issue 1 year ago • 4 comments

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.

alefminus avatar May 19 '24 04:05 alefminus

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.

mscolnick avatar May 19 '24 15:05 mscolnick

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

alefminus avatar May 19 '24 17:05 alefminus

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.

akshayka avatar May 22 '24 22:05 akshayka

Grabbing this one next 🙂

wasimxyz avatar Aug 11 '24 17:08 wasimxyz

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.

wasimxyz avatar Aug 15 '24 03:08 wasimxyz

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 avatar Aug 15 '24 13:08 mscolnick

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

mscolnick avatar Aug 15 '24 13:08 mscolnick