Bug: text loses characters on cmd+z undo


Love this product by the way. The most amazing thing on the internet for developing stuff imo :slight_smile:
I’ve been working on a private project and when I undo an edit it loses characters (not from the text worked on but from other elements) e.g. two instances of ‘var’ changed to ‘ar’ when I had never deleted those vs before. Didn’t know whether this was a known bug so thought I’d report it. Am using a desktop text editor to work in and pasting code in until it stops, so I have a workaround.


Hi @storyjack3r :slight_smile:

I am not able to reproduce this bug, if you have a list of steps to consistently reproduce it, can you tell us :slight_smile: ? thanks!

I’ll try. I’ve closed and reopened the browser window running glitch. Will see if the error occurs again.

Okay, so the error goes like this:

While debugging, I comment some code out, then straight away I decide to uncomment… when I press undo on this text:

//    client.message(data, {})
//.then((witData) => {
//  console.log('Yay, got Wit.ai response: ' + JSON.stringify(witData));
// })
// .catch(console.error);

it turns to

client.message(data, {})
// en((witData) => {
//   cole.log('Yay, got Wit.ai response: ' + JSON.stringify(witData));
// })

then when I press undo again (ctrl+z) it goes to a previous instance of editing before commenting out.


Ok cool, thanks! I think I know what’s going on! We should be able to fix this soon :slight_smile:

Brilliant. Only have good things to say about glitch - amazing thing you have made :smiley:

Refresh your editor window and this problem should go away :slight_smile: Thanks!

Greetings all,

@etamponi, I assume that what I’m experiencing is related to this issue, so if it helps at all, I’ve just made a little screen recording of the kind of behaviour I’m encountering when I use Command+Z to undo.

In the attached recording, after I type “fixed”, all I’m doing is pressing Command+Z repeatedly. And just to be clear, where “r”, “taticr” and “xedsf” appear on screen, none of these are values that I’ve previously entered for the CSS property shown.

If it helps to know, I’m using Chrome (Version 65.0.3325.162 (Official Build) (64-bit)) on macOS Sierra, 10.12.6. And if it further assists, I’ve forked the project I was working on when I made the screen recording, and the forked version is here.

(But finally, allow me to echo @storyjack3r’s gratitude for Glitch!)



Thanks for the report @DenisMcDonald,

we’ll investigate :slight_smile:

Hi @DenisMcDonald,

you were right! Fixing the previous issue caused the one you saw :slight_smile: We investigated and figured out the root cause. Now both things should be fixed!

Thanks again!

1 Like


I’m happy to have helped, @etamponi (and, as a beginner, happy I wasn’t just mistaken about something!).


1 Like


By default when you comment out more than one line of code with JavaScript each line comment is done in one function, so when you attempt to undo a comment it will undo one line at a time. To uncomment it all just use the comment command again while selecting the commented code.

Of course, different programs have different custom functions, but I know that Glitch does this as I have run into that issue myself.

Hello @Crazy,
I think this specific issue is now fixed. Are you still having it?

1 Like

Yes, it is. That’s a cool add-on, thanks!