Undo doesn't seem to work within code block

To replicate:

  1. Edit something within code block
  2. Attempt to Undo
  3. Get the message that there is nothing to Undo.

Don’t know if desktop behaviour is the same.

Hi @qualquertipo, please use the full template for Bug Reports, platform and Anytype version used are really useful information.

I could not reproduce this on Windows 11 - Anytype 0.27.0. Are you on android or iOS?

The tag indicates Android. I tried to reproduce on Android and I think the undo button does work, but that it does not register the order of actions taken in a code snippet block.

@qualquertipo could you try this:

  1. Open Object with code snippet block
  2. Make an edit to anything BUT the code snippet block
  3. Make an edit to the code snippet block
  4. Use the undo button a few times

Does the order in which changes are undone seem odd to you, too?

Oh thanks! My bad.

Sorry if I get into the discussion but I did some trying and this is what happens on my Anytype (0.27.0 - Android 12).

Not only the undo order is not correct but if you redo and undo again then the order is right.

Update: in the video the undo order is correct, apart (if you notice the clicks) of one undo which does nothing. I did however get a wrong undo order while trying things for the video but I’m not sure what changed.

Hmm, the undo and redo looks correct in your screen capture and I can’t seem to reproduce my own steps…

@qualquertipo if you have the time, could you make a screen capture of your issue?

True, I did a few more tests and it seems to be all over the place. Undo involving code blocks either happens out of order, never happens or happens correctly .

Sorry I don’t have time to do a video.

By the way, this happens often in AT for me - bugs that aren’t easy to replicate. When this happens, I tend to not report it, as I know I won’t have time to follow through on in (provide evidence etc.). Not laziness, just lack of time. I understand why devs need bug reports to be as thorough as possible. Am not complaining about that. Am just pointing out that this might be leading to a lot of underreporting of bugs. Hope that makes sense!

For example, right now as I was testing the bug above, I got 2 other bugs:

  • Using the inline /Code command didn’t work (first option on image below)
  • Trying to add text under an empty code block didn’t work (cursor didn’t show when tapping in the area)

But both were hard to replicate (only happened half the time) so I decided not to report it since I wouldn’t be able to follow through on them.

1 Like

Just trying to clarify as this was not clear for me the first time: The first option is for styling, so it would apply a Code style to you block . It is only working if you already have a text block with content. When the cursor is in the block, you can use the / menu to apply the code style to the whole block.
The second option is also something I experienced, and I could not find any other way than selecting the code block by holding the block, and then using the “add below” option.

I’ll see if I can find existing bug reports for this.

Ah! I thought it would apply to the next text I typed. So I typed right after, which cancelled the styling.

I created this

1 Like