Page 1 of 1

Gripes with Livecode

Posted: Mon Jan 06, 2014 6:29 pm
by carel
I absolutely love Livecode, but there is one thing that is annoying me so much:

When I copy / paste part or whole or change structure in or around if and end if statements, the alignment goes out.

Sometimes I can just backspace or delete the end if and type it in again and it gets aligned properly again, but usually and especially if you make major changes to the structure (move lots of code around / take end if's out and add and so on) I CANNOT get it aligned properly without typing the whole thing over and then deleting the offending part, and sometimes it is a lot of typing.

Example:

if this or that then
do this
if this or that then
do this
end if -- (do I have to use -- here? haha) <-- Then you can't get this end if to align back properly
end if

Regards,

Carel

Re: Gripes with Livecode

Posted: Mon Jan 06, 2014 6:33 pm
by Dixie
press the tabKey to get scripts to format if they are out of line

Re: Gripes with Livecode

Posted: Mon Jan 06, 2014 7:02 pm
by Klaus
I also have some problems when pasting text/scripts from this forum into the script editor!
TABKEY does not help, I need to really delete and replace all CRs and SPACEs to get the script to align correctly.

No idea what is causing this, I guess some hidden (and uncommon to LC) characters, never bothered to find out what exactly.

Re: Gripes with Livecode

Posted: Mon Jan 06, 2014 8:29 pm
by bn
Hi Klaus,

somehow when you copy from the forum to the script editor it does not align correctly.

The cause to this seems some ascii 202 in the text which Livecode inserts when pasting. It is not in the forum code. 202 seems to be a non-breaking space.

If you replace ascii 202 with "" in e.g "TextWrangler" on a Mac it will format correctly. (just show invisible characters, do a find/replace for the "bullet" in front of script lines, and copy paste back into Script editor).

I guess one could write a plug-in :)

the code could be

Code: Select all

on mouseUp
   put the clipboardData ["html"] into tHTML
   replace "&nbsp;" with " " in tHTML
   set the clipboardData ["html"] to tHTML
end mouseUp
run this after copying from the forum and before pasting into the script editor.

I was always too lazy to do this but maybe....

Kind regards
Bernd

edited the code to replace the non-breaking space with a space, before it was ""

Re: Gripes with Livecode

Posted: Mon Jan 06, 2014 8:52 pm
by jacque
I've noticed the same problem when copying from the forums here. I have a Firefox plugin installed that allows me to copy either "plain text" or html text. If I copy the plain text, it formats fine in the script editor. The plugin is called "Extended Copy Menu" if anyone who uses Firefox wants to give it a try.

Re: Gripes with Livecode

Posted: Mon Jan 06, 2014 9:03 pm
by bn
here is the rough plugin. Either run it as stack or put it into the plug-in folder to access it from the Development menu-> Plugins

Kind regards
Bernd

Re: Gripes with Livecode

Posted: Tue Jan 07, 2014 5:16 pm
by carel
Thanks for all the replies.

The problem I have is copying and pasting my own code from different card or handler etc.

I'll try TAB, what Dixie suggested when it happens again.

I generally do not copy and paste from the forum / web. I view on my one screen and type on the other.

Thanks,

Carel

Re: Gripes with Livecode

Posted: Wed Jan 08, 2014 3:10 am
by keram
carel wrote:When I copy / paste part or whole or change structure in or around if and end if statements, the alignment goes out.
I'm not 100% sure what you mean but if it is what I think then try this:

1. Select in the script editor the whole part of the code that you want to align properly
2. Comment it (Ctrl+- on a PC or Edit>Comment)
3. Uncomment it (Ctrl+_ on a PC or Edit>Uncomment)

keram

Re: Gripes with Livecode

Posted: Wed Jan 08, 2014 4:17 am
by dunbarx
Hi.

Sometimes, and this goes back a long way, if/then constructions may not indent properly when condensed. They always do if expanded fully:

if whatever then
doThis
else
doThat
end if

As opposed to, as just one example:

if whatever then
doThis
else doThat

The handler may compile correctly, but not align. Can you test this? I am not sure if this is your issue, but take one or more of those and test. I have never been able to learn in what context these happen. Sometimes I just fool around until it works

Craig Newman