Losing code, Editor quirks

Everyone, if you go into Settings and scroll down and tap on Codea, what do you have set for Document Storage. Don’t know if that might be a cause, but it might help track things down. Mine is On My IPad and I haven’t noticed any issues. I haven’t been doing the Save and Run option either.

PS. I’m also not doing anything with the Files app with Codea.

I didn’t know about that. Mine was set to iCloud Drive (which I don’t even use). I switched it to On My Ipad. Feeling optimistic! I’ll let you know how it goes.

Thanks @dave1707 for the tip. Mine was also set to iCloud Drive and I know that my iCloud was getting full up so that might have been contributory. I’ve set mine to On My iPad and will monitor its behaviour.

Likewise - bug has been total pain - fingers crossed this resolves it

Initial prognosis: doesn’t help.

I switched to ‘On My iPad’ and I’ve been editing a project and been hit multiple times by the “not saved” bug.

@LoopSpace I wasn’t sure if that would help or not, but I thought I’d suggest it anyways. How large of a project and how many tabs is your current project. I’ve been trying to cause the problem to see if I can track something down, but I haven’t been able to cause it. Maybe with more info and everyone trying to pin it down, we can find the cause and get it fixed.

Trying to create loss of project data bug, but I can cause a Codea crash consistently. Don’t know if this is related to the project data loss.

  1. From the Files app, open a Codea project.
  2. At the project editor screen, finger squeeze the screen to minimize it.
  3. Tap the Files app screen to enlarge it.
  4. From the Files app, open the currently running Codea project.
  5. A loading spinner will show but the project won’t open.
  6. Finger squeeze the screen to minimize it.
  7. Eventually a pop up will show saying Codea Crashed and asks if you want to share additional information with the developer.

@dave1707 It was definitely worth a try. I shall try again as I didn’t force-quit Codea between making the change and coding (but my iPad is out of juice so I’m waiting on that).

My current project is 3 tabs, the primary tab is about 500 lines long. It does side-load quite a large amount of code from other projects, though. That shouldn’t affect saving because it should save it before trying to run it.

Here’s some code that shows the purpose of the Run & Save option of long pressing the Run icon. Make a change in the prt function and run (not run and save) the code. It displays the code on the screen. Keep tapping the screen to reread the tab and it takes about 10 seconds before the code is actually updated. If you do the Run & Save, the code is updated before its run. I’ve been playing around with this trying to get the bug to show by force closing, causing errors, or anything. But so far I haven’t had any success to get the bug.

PS. I’m wondering if there could be something happening at the time when the code is being updated and something else going on.

PSs. Somehow, Codea has to be interrupted before it can update the current edited code so that the code in some buffer is still there and used ignoring any changes just made.

displayMode(FULLSCREEN)

function setup()
    cnt=0
    prt()
end

function draw()
    background(0)
    fill(255)
    text("tap screen to read tab, count   "..cnt,WIDTH/2,HEIGHT-100)
    text(str,WIDTH/2,HEIGHT/2-10)
end

function prt()
     
    print("0")  -- change something here between the “ “      

    str=readProjectTab("Main")
end

function touched(t)
    if t.state==BEGAN then
        cnt=cnt+1
        prt()
    end
end

Not sure if this will explain anything, but if you load this code, then remove the function temp, and run the code which I have coded to crash Codea, after loading the code again, the function temp will still be there. If you do the above steps with Run & Save, then the function temp won’t be there if you removed it.

It takes about 10 seconds for the edited code to be updated. So if you’re in a cycle where you change and run your code quickly and Codea crashes, then your changes won’t be there when you reload it.

Does this seem to mimic the problems somewhat.

Just so everyone knows, the code xx=xx…xx causes Codea to run out of memory and crash.

function setup()
    xx="qwertyuiop"
end

function draw()
    background(0)
    xx=xx..xx  
end

function temp()
    print("temp")
end

Not sure if that’s related, but lately I’ve been experiencing similar problems:

  • Editor randomly crashes and loses lately added edits.
  • Even switching the code tab can lead to code loss.
  • When running project, exiting the app, you may notice your code is lost.
  • Touching the sprite and color selector leads to the crashes most of the time.
  • If editing the code and exiting by going back to the start screen, code may be also lost.

I lost two hours of work yesterday. I suggest everyone until the fix to

  • edit only a little, make sure you saved the part (Hold the run button), click Save & Run

@Simeon is it possible to add in the next version a save indicator. If your code is saved, at the top show an “Your code is saved” indicator. Also add a force-save button, where code will be saved, if not automatically before.

@Simeon - I know it’s low priority, but just letting you know I have seen similar problems with not updating the edited project code in Air code Codea on my browser. It also has a greater tendency to bomb out of Codea. When editing with Air code I tend to exit to the list of projects and run another project before switching back to ensure edits have been adopted - that usually works fine. But, if you don’t run another project and return to the edited file the edits have disappeared. I am using Safari on my Mac.

Note also, the tendency to bomb out is usually in the project list window after a short period of time. Could this be down to the same code changes in the latest beta?

@Anatoly - some of these bombing incidents seem to be tied to the filing system - such as the sprite selector. I mentioned to @Simeon before about modifications to the file system but he reported no change there. But, have Apple changed the system in their filing libraries? Or have they introduced new issues with the iPadOS launch?

I have to admit that I am holding off on most of my projects until this is resolved. It’s unfortunate, considering this is (and I am sure will continue to be) my go-to dev environment for fun at home. I will celebrate when we are past this!

Jump down two - posted on a phone originally which wouldn’t let me enter links properly !!! Dohhhh

@Anatoly - sounds like quite a few members have encountered problems with lost code. I’ve even seen it with Air code. Suggestion for anyone with a PC or Mac - set out your code in an editor then cut and paste to Air code retain your code in the editor files - messy but at least you retain the code in the text editor.
No feedback from @Simeon as yet - must be tough problem.

Thanks for this - I’m finding it particularly frustrating of late. Hoping it gets resolved soon

If code edited, asset picker - opening to edit a shader - crashes the editor.

Codea is not crashing when opening the shaders lab from the start screen.

All - just picked up on a techie website that iOS 13 has introduced major bugs, in particular memory management which has caused apps to crash. I assume iPadOS suffers from the same problems. If so, resolution of our recent problems could take a significant time to resolve.

Link below - not sure how reliable it is.

Techie Comment

IOS update installed and no lost code yet. Fingers crossed the issue is resolved.