Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Codea 3.4.3 (301)

dave1707dave1707 Mod
edited September 19 in Beta Posts: 9,584

@Simeon I was able to paste (Add To) a sprite easily into a sub folder of a project folder. Also, are you still working on the 7 second delay for Codea startup or is that an iOS 15 fix.

Comments

  • SimeonSimeon Admin Mod
    Posts: 5,714

    @dave1707 the problem with the delay is a bigger fix than I anticipated. The faster-loading versions you had access to earlier had issues with crashing for you. So while I know where the code causing the delay for you lives, I can't modify it easily

    Do you use many sub-folders in your Documents folder for Codea? Or is almost every project just in your iPad Codea Documents folder?

    It may speed things up to use sub-folders and organise your projects (though apologies if it doesn't). As the delay appears to be related to listing directory contents for the documents folder on load

  • dave1707dave1707 Mod
    Posts: 9,584

    @Simeon All of my projects are in the documents folder, no sub folders. I guess I could try sub folders and see if that will speed things up. Just one problem, maybe two. I have two projects that parse through every project. One is a search that I use to list off any project that uses something specific I’m looking for. The other is a backup program that I use. Will the listProjects function also go into sub folders. That will decide if I do sub folders or not. The search program is used extensively when someone has a forum question about something.

  • SimeonSimeon Admin Mod
    Posts: 5,714

    @dave1707 good question. listProjects can accept an argument which is the "collection" you want to list. For example to list the example projects you can do:

    listProjects("Examples")

    However the better way to introspect your projects would be to use the asset key API

    Here's code to recursively search the Documents folder for all Codea projects:

    function setup()
        projectsInFolder(asset.documents)
    end
    
    function projectsInFolder(folder)
        for k,v in pairs(folder.all) do
            if v.type == "folder" then
                -- Recursively search folder
                projectsInFolder(v)
            elseif v.type == "project" then
                print(v.name)
            end
        end
    end
    
  • SimeonSimeon Admin Mod
    edited September 20 Posts: 5,714

    @dave1707 further to this, the asset API should completely negate the need for most of the project info and reading APIs

    When you find a project, you can do

    project.all to get a table of its files. If they are Lua files, you can simply read them with readText. This means specialised functions like readProjectTab are no longer needed

  • dave1707dave1707 Mod
    Posts: 9,584

    @Simeon That works. Thanks for the example, it saved me from trying to figure it out myself.

  • dave1707dave1707 Mod
    Posts: 9,584

    @Simeon Is there any way to add the expand and compress icon to the documents list of projects like there is for Examples and Craft. Just wondering if the list of projects for documents was compressed at startup if that would load faster. Then after Codea is loaded, we could expand the list of any folder.

    Not trying to get out of creating a bunch of folders, just thought of that as I was creating some folders.

  • dave1707dave1707 Mod
    Posts: 9,584

    @Simeon Maybe I’m thinking about this all wrong. Maybe all my projects could be moved into a single folder then they would have the expand/compress icon. Just trying to figure out what I want to do before I start messing with 700+ projects.

  • SimeonSimeon Admin Mod
    Posts: 5,714

    Fair enough @dave1707, let me know what you come up with and if it works or not

  • edited September 20 Posts: 2,428
    @Simeon - apart from it being the latest beta I'm watching this thread closely as I use @dave1707's archiving project and have simiilar code for other projects.

    I was wondering if you can set flags on projects to indicate change - addition/removal/update of assets within, which may enable you to keep a hidden directory, to use on startup, then you could only update those that need it so you can speed up the start of Codea?
  • SimeonSimeon Admin Mod
    Posts: 5,714

    @Bri_G I try to avoid too many optimisations as they often have unwanted side-effects in other parts of the app. The code which is slow in this instance is simply listing the contents of the Documents folder — something which does need to happen on startup.

    The way to make this faster would be to do it in the background while the UI starts up and then fade in the projects when complete. But I'll see how dave goes with reorganising his projects before optimising for this scenario.

  • Posts: 2,428
    @Simeon - thanks for the update. Further question - we only load up one project at a time so - could you just load up the project icons initially (and folder images) then concentrate resources on loading the project or opening the folder when requested. Might slightly slow down response for each request but that may be less noticeable?

    Or, is that the way Codea currently operates?
  • edited September 20 Posts: 2,428

    @dave1707 @Simeon - just loaded and playing with 301. One thing I noted was the Codea icon in the Fileapp is just showing a blank folder without the icon. Does that mean iOS is treating it as a basic folder not an app?

    Secondly, after playing with 301 for a while I found Fileapp had locked up. Tried to duplicate but no joy so far.

    Suggestion, whilst resolving all the other issues, could you organise the folders that are recent to the top (or can I get that from the setup menu already). I added a new folder and copied a file to it and it ended up at the bottom of the pile, open and showing the file).

    p.s. checked the order and it was set to recent. Changed to alphabetic and the collection list was still in the same order.

    Do you intend to display collections as folders in future. If so could you consider using a miniature project icon (like the apps folders in iOS).

    Sorry for being a pain - these are probably features you’ve already added to 4 and seems a little pointless building up 3 if 4 is close.

  • SimeonSimeon Admin Mod
    Posts: 5,714

    @Bri_G good point about the sorting of collections themselves. They sort by name, but it makes sense that you might want them sorted by recent. I have thought about using folder icons for them, but it's probably not something for Codea 3.x

  • dave1707dave1707 Mod
    edited September 20 Posts: 9,584

    @Simeon I moved all of my projects into a folder. If I have that folder collapsed, Codea starts up in less than a second. If I have the folder expanded, Codea takes about 7 seconds like it did before.

    When I do a Create New project, it’s created in the documents folder. Is there a way in Codea to move the new project into the folder where I have all my other projects. Or could an option be added to Create New to choose a folder to create the new project into. I know I can use the Files app to move projects, just wondering about doing it in Codea.

    Another thing, when Codea is closed, could all the folders be collapsed. Maybe that could be an option so those that don’t have a lot of projects and wont see the delay.

  • edited September 20 Posts: 2,428

    @Simeon - to make icons simpler for you - you could put a standard icon in the folder and permit users to change it thus avoiding Codea needing to create one.

    I know it will add to the processing time but only you can determine how much.

  • dave1707dave1707 Mod
    edited September 20 Posts: 9,584

    @Simeon After moving all my projects into a folder, I’m noticing that functions like hasProject, createProject, deleteProject, etc aren’t working. At least I can’t get them to work.

    PS. I moved all my projects out of the subfolder back to where they were. I’ll wait the 7 seconds for now. I would forget to compress the list when closing Codea and have to wait the 7 seconds to load anyways.

  • @Simeon the soundsplus example gives error message-due to the use of 'loadstring'.

    Also had a crash when restoring examples (sent you the crashlog). Worked ok the second time.

  • dave1707dave1707 Mod
    edited September 20 Posts: 9,584

    @Simeon Cargo Bot also has a loadstring in it. Just need to change loadstring to load until the Examples are fixed.

  • SimeonSimeon Admin Mod
    Posts: 5,714

    @dave1707 hasProject can be replicated using the asset key API. I will come up with more general replacements for createProject and deleteProject. Thanks for the details about how it takes longer when the section is expanded

    @piinthesky thanks for the crash report! Will search and fix the uses of loadstring

  • edited September 24 Posts: 1,125

    Using (301) with iPad Pro and Magic Keyboard, often the %-> does not go to end of line. Instead it stays where it is. If I do -> and then %->, it goes to the end of the line.

    Easiest duplication I've found is on a new line type foobar, then cursor back between foo and bar, hit enter to split the line. %-> does nothing until you do an -> alone.

    (% = Command key, -> = arrow key)

    :)

  • edited September 25 Posts: 1,379
    @Simeon I’m sorry to say I just lost some code, in version 301 on iPhone.

    It was only a few lines that vanished, from two different tabs, but it definitely happened.

    I don’t remember doing anything noteworthy either—this wasn’t in a project that writes to tabs or reads from tabs, and it also isn’t a project in a working copy repository.
  • SimeonSimeon Admin Mod
    Posts: 5,714

    @UberGoober thank you for the report! Sorry that it happened again

    @RonJeffries thank you for the easy reproduction steps. Happens to me, too. Will fix

  • SimeonSimeon Admin Mod
    Posts: 5,714

    @RonJeffries looks like this is a bug with Caret Placement Style set to "Exact"

    If you open Do -> Preferences and set "Caret Placement Style" to "Word Boundary" this will behave as expected when using Cmd+Arrow navigation

  • Posts: 2,428

    @dave1707 - could you just check this out for me, attached a zipped copy of a timer I was playing with, rather than copying and posting the code. When I try to run it the run button won’t respond. So, I’m wondering if I have done something stupid with the code (not impossible) or there is something embedded in the file screwing up Codea.

  • dave1707dave1707 Mod
    Posts: 9,584

    @Bri_G Not sure what you’re referring to. Touching the screen starts and stops the timer, no problem there. Not sure what the yellow rectangle is supposed to do. There’s no code to do anything with it.

  • Posts: 2,428
    @dave1707 - thanks for testing it. The problem was it would not run for me at all.
    Begining to think this may be an internet problem as some of my gear seems to be logged off and requires reconnecting. Could be dropouts from my internet service. Call for socket is at begining.

    It did throw up an error that it had problems with a
    "helper function".
  • dave1707dave1707 Mod
    Posts: 9,584

    @Bri_G I never had any trouble with touching the screen to get it to stop or start. I took my iPad offline and your code still ran OK. Socket should be in the Codea code so internet problems shouldn’t matter.

  • Posts: 2,428
    @dave1707 - the first thing it does is the socket call which may start running before the screen switch occurs. I'll try running with socket remarked out. Thanks.
  • Posts: 1,125

    ty, will try that!

  • edited September 27 Posts: 1,379
    Well I just had the losing-code bug happen in reverse.

    In regards to a different thing, @dave1707 had suggested I simplify a project, so I spent a little time deleting around 10 of its tabs I didn’t actually need, and I then I started going through the actual code and deleting stuff.

    Suddenly, for no appreciable reason, the cursor popped to the top of the tab I was on, and then I noticed, presto, all those tabs were back!
  • Posts: 2,428

    @Simeon - just installed iPadOS and noted a problem with export. In the second dialogue box, opened by export, there are three commands on the top of the window

    < export project Create Project. Done >

    which are not within the box but over the project window. Can’t remember seeing this before the new OS.

  • Posts: 1,125

    I'm still not enjoying the new handling of shortcuts. The cursor bounces down to the shortcut line whenever Codea thinks it might be able to help me. It is rarely correct about that, and there's no practical way to get the cursor back where it belongs. up arrow down arrow nearly works, but the thing is, you're typing away and then all of a sudden nothing is happening.

    If we think of how such things usually work, they show up as a vertically stacked list and you cursor into it if you want to select something, or type tab if you want the one at the top. If you just keep typing, it leaves you alone.

    I think it'd be better if Codea never stole the cursor. The question of how to get into the list then arises. Down arrow may not be the right choice, since down arrow usually takes you down one line in the editor. Tab might be a decent choice, since tabbing after typing a few characters is rare.

    I don't have a great idea, but I'm almost wishing I could turn the feature off, and that would be sad, because when you want it, it's great.

  • SimeonSimeon Admin Mod
    Posts: 5,714

    @RonJeffries it shouldn't steal the cursor — the only key events that are taken by the autocomplete suggestion bar are left / right arrow keys and tab (or return).

    If Codea is eating other keypresses when the autocomplete bar shows up then that is a bug, if you have steps to reproduce that would be appreciated

    I modelled the behaviour on other IDEs, which typically show a vertical list of suggestions. When the list appears, the up and down arrow keys no longer navigate your code but instead allow you to highlight a selection from the autocomplete list, return or the tab key will insert the suggestion

    The only difference in Codea is that the list of suggestions is presented horizontally, so the left and right arrow keys are used to highlight an item in the list rather than up and down

  • Posts: 1,125

    yes, but consider this example:

    assume there's some suggestion, x1. you type x, and the suggestion appears. you don't want x1, you're done with x and want to cursor right, over a closing paren or something. you can't: you're trapped in suggestions until you tap the screen or cursor out of your line.

  • SimeonSimeon Admin Mod
    Posts: 5,714

    @RonJeffries I see, good point. I could change it so that you can navigate the autocomplete list with up/down keys instead of left/right — it may be the case that left/right is too commonly used to intercept

    Also, just a note that the tilde/backtick key (`) will also dismiss autocomplete

  • edited October 6 Posts: 1,379

    Lost work.

    Was in 2nd tab, tapping undo key several times in a row.

    All of a sudden cursor was at top of 2nd tab, but 2nd tab was a different tab, because the entire project had reset itself to what (I’m assuming) was its state when I opened it — and I’d rearranged tabs since then.

    And of course all the code I’d written since then was gone too.

    iPad Pro, iOS 14, project synced with Working Copy.

  • Posts: 1,125

    tilde. i'll remember that.

    in other news, replace all destroyed my program again. fortunately, i had a git revert close at hand. i think replace should be removed.

    finally, what makes find show some finds in black and others white?

  • Posts: 1,379

    I suppose it’s my own fault since I know this bug exists, and so I should close and re-open my project every minute or so, since the bug seems to reset a project to the last opened version, but this time I lost about an hour of work. Eeps.

  • SimeonSimeon Admin Mod
    Posts: 5,714

    @UberGoober I'd like to try to reproduce your environment

    The project is in Codea, locally?

    It is synced to Working Copy via the Synced Folder feature? Or some other way?

  • Posts: 1,379

    @Simeon yes, the project is local, right in the default Codea directly.

    I think that is how Working Copy is set up, but I did it a while ago, is there anyway to tell?

    I realize that something I haven’t checked is whether or not the code is being reset to the last committed version in Working Copy, which is somewhat embarrassing, because it seems like such an obvious thing to investigate.

    I’ll keep that in mind next time this happens.

  • edited October 8 Posts: 1,379

    OK, it just happened again, and I can confirm that it is not resetting to the last committed version of working copy.

    What just happened is:

    • I wrote a bunch of code, committed it with working copy, and pushed it to github.
    • Went to another project.
    • Went back to the first project, and noticed a bunch of my code was gone.
    • Went to look in working copy, and thankfully it did just what it was supposed to do, it had saved all the changes I made, and the code loss now appeared as new changes that could be committed.
    • I committed the current version, that was missing all that code, and then made a branch out of the previous commit, switched to that branch, and got all my code back.
  • Posts: 1,379

    Ok, here’s another weird one (sorry).

    In the first image you can see the entirety of the project. That’s all there is.

    The second image shows the program running.

    ??? where is that button coming from?

    I do have a button like that in an entirely different project, but I’ve never had any of that code in this one.

  • dave1707dave1707 Mod
    Posts: 9,584

    @UberGoober Did you by any chance have CodeaUnit as a dependency. Is this project a new project name or is it a project name that existed and you just deleted everything in it and added the new code.

  • Posts: 1,379

    Good thinking @dave1707, it does have a dependency on a project that uses that CodeaUnit button, I completely forgot. Once again I’m embarrassed! …….never mind……. blush

Sign In or Register to comment.