Codea 3.3 (263) (264)

@Simeon I tried the random keying with occasional space to test the wrapped line and the cursor jumped to the middle of what I was keying. As I kept keying, the text disappeared and the blue highlighting showed on several lines. Also the cursor was locked on the screen. I could still key stuff where I tapped, but the cursor indicator never moved.

Can you also check the Voxel Editor example. It gives an asset warning and I can’t get it to load or save anything. I mentioned this in the 262 discussion.

If a line starts left justified, it doesn’t indent the next line wrapped line.

@dave1707 that is intentional (left justified lines not indenting), but maybe I should change that behaviour to match indented lines

Thank you for the report about the text disappearing and voxel editor, will add them to the list

@Simeon - been there a while, mentioned before, but the indentation whilst pasting seems wrong. I often indent tables so each entry is tabbed out and parallel. Also I frequently copy a table entry and paste/append it whilst building the table - then edit it’s contents doing so now pastes without indentation. Even if you copy the whole line indentations are ignored all pastes are aligned to the left of the page. Has this always been the case? I thought we used to retain formatting.

@Bri_G there is a setting to disable re-indentation on paste. If you choose Do → Preferences… from the menu then un-check “Format on Paste” Codea will no longer attempt to re-indent code when you paste

@Simeon - thanks for the feedback but that just seems to be for wrapped lines. What I was referring to was the copying and pasting of lines. For example in the following code, copy and paste a line of tabulated data either the data itself or the complete line.


sysPic = {
            "galaxy01",
            "galaxy02",
            "galaxy03",
            "galaxy04"
        }

On my system the pasted item always starts fully left with no indentation.

@Simeon - just loaded an old project posted by @juaxix - MagicaGems. Which fired up several problems, old code so expected. One of which was a lot of the code had several errors due to a lot of spaces after the variable name before the = sign. Deleting these from the left resulted in the error remaining (note more than two extra spaces). Deleting the space just before the = sign removed the error until you moved the cursor do you have a control character before the = sign? In the new editor. This may cause problems in pasting old code.

Also, There was an error at the top of the code on every tab. On function setup(). After a lot of fiddling by cutting the whole tab code and reposting.

Which brings me to the selection of all code in a tab. Only safe way to do it is from bottom up. Selecting top to bottom results in the bottom selection handle on the last line but at the far right. The selection menu flashes on and off. I then try to drag the lower selection handle down again sometimes it goes to the top of the code with a few lines selected. Sometimes it moves to the last end statement Which is OK. Sometimes you lose the selection. You can not drag the selection handle beyond the last end statement which used to be the case resulting in the selection menu visible awaiting a response.

Could be my old habits no longer work and I need to learn the new procedures.

@Simeon Just loaded version 264 and I’m not seeing a difference in the autocomplete on/off for how I code. If I try to type a*b[c[d]] I’m hitting the X to clear the autocomplete bar several times. I thought maybe the bar wouldn’t show unless I tapped on the “X” (shown someplace on the keyboard) to show the bar. I’m almost tempted to ask you to put an option in the preferences to just turn the autocomplete off.

@Simeon Maybe you can do something like this. With autocomplete ON, if I type an “a”, you show the bar with all the “a” matches just like it does now. If its OFF, if I type an “a”, you don’t show the bar unless I tap on the “X” (shown someplace on the keyboard) or put a “Show AC” in the “Do” drop down menu. If I tap “Show AC”, you clear the “Do” drop down and show the bar just for that occurrence. You don’t show the bar again unless I want it shown for the next match.

@dave1707 you won’t see a difference unless a, b, c, d are actually variables in your code. I.e., it won’t work if you just type that line with no context for Codea to know that those are full symbols and shouldn’t show the completion bar

@Simeon I see what you’re saying. I’ll see how it goes when I start keying a program. Having it come up one time is better than all the time.

@dave1707 my thinking is that the first time it comes up, it will probably be relevant because it means that variable is not defined yet so you may be trying to refer to a different variable of which you have typed a partial amount, or to an API.

After that any time you type or select a completion that fully matches a variable or API the bar will not show unless you try to type further

@Simeon - just playing with my current project and trying to get the assets into the Project folder. Never been clear how to do it. In the past I have been able to add plists icons code files images and data files by exporting to a PC/Mac adding as necessary then copying the resultant file back into the Codea root folder. That worked.

Project files are not visible with the asset viewer on my system - is there a preference for setting this as active?

I’ve found another potential way to deal with this - if I have a project.code file with the code present and I need to see assetsI create a project.assets folder and add the relevant assets and place some other icons in there with the plist etc. then you can see your project in the asset viewer. Is it possible to make the Codea system read the assets from the .assets folder in this way when exporting your project placing them inside the project .codea folder. I know this doubles the folder numbers but it could be a workaround. You could also have the system check for new .asset folders and copy the relevant icon files from the project.codea folder to the .assets folder.

Just a thought.

@Bri_G this is a longstanding problem with Codea’s asset design that I hope to fix in version 4.0. I’ll see if I can make some quick tweaks to 3.x that make projects easier to inspect and import files into

@Simeon - thanks for the update.

@Simeon - some code that @loopspace posted for @Bortels - this crashed after pasting into tab and running.

function setup()
    stars = {}
    numstars = 1000
    local x,y
    for i = 1,numstars do
        x = math.random(-WIDTH,2*WIDTH)
        y = math.random(-HEIGHT,2*HEIGHT)
        z = math.random(10,100)
        table.insert(stars,{x,y,z})
    end
    v = vec2(0,0)
    l = 30
    p = vec2(l,0)
    o = vec2(WIDTH/2,HEIGHT/2)
    tolerence = 25
    M = 100
    dM = 5
    G = 100000
    mu = 0
    ds = 0
end

function draw()
    background(0, 0, 0)
    noStroke()
    fill(255, 255, 255, 255)
    rectMode(CENTER)
    translate(o.x,o.y)
    if CurrentTouch then
        local pp = vec2(-p.y,p.x)/p:len()
        local d = vec2(CurrentTouch.x,CurrentTouch.y)
        d = d - o
        debuga = math.atan2(d.x,d.y)
        local dd = vec2(CurrentTouch.deltaX,CurrentTouch.deltaY)
        if dd:lenSqr() < tolerence and CurrentTouch.state ~= ENDED then
            ds = ds + DeltaTime
        else
            ds = ds - DeltaTime
        end
        if d:lenSqr() > tolerence then
            local a = G * M * d:dot(pp) / (d - p):len()^3
            
            a = a - mu * v:len() * v:dot(pp)
            v = v + a * DeltaTime * pp
            p = p + v * DeltaTime
            p = p/p:len() * l
        end
    end
    for i=1,numstars do
        stars[i][1] = (stars[i][1] - math.exp(ds)*p.x/stars[i][3] + WIDTH)%(3*WIDTH) - WIDTH
        stars[i][2] = (stars[i][2] - math.exp(ds)*p.y/stars[i][3] + HEIGHT)%(3*HEIGHT) - HEIGHT
        local r = math.random(1,3)
        rect(stars[i][1],stars[i][2],r,r)
    end
    local ang = math.atan2(p.x,p.y)
    debug = ang
    rotate(180-ang/math.pi * 180)
    spriteMode(CENTER)
    sprite("Tyrian Remastered:Boss D")
end

@Bri_G thanks for that! It’s because of the global variable called debug — rename that and it should be OK. I’ll have to put a fix for this into Codea

@Simeon - thanks, couldn’t find the fault but, since you pointed it out, it looks like a typing error as debuga is defined earlier in the code. Editing that and it runs OK. Is debug a reserved word in the system or in Lua?

@Simeon sometimes i seem to be able to select text in the editor and get the blue selection background but without the ‘lollipops’ each end to access the cut/paste options. Is that intended or a bug? I can’t find a prescription that lets me do that at will though!

@piinthesky - I have noticed similar effects but found the selection handles fully to the left and round the keyboard. Sometimes when I try to scroll up I have lost the selection. What used to happen is when you reached the bottom of the text below the text was a blank line so the selection handle was on the left below all the text easy to see and access. I found that a better process.