Gripes with Livecode

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
carel
Posts: 58
Joined: Mon Jul 29, 2013 2:49 pm

Gripes with Livecode

Post by carel » Mon Jan 06, 2014 6:29 pm

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

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: Gripes with Livecode

Post by Dixie » Mon Jan 06, 2014 6:33 pm

press the tabKey to get scripts to format if they are out of line

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Gripes with Livecode

Post by Klaus » Mon Jan 06, 2014 7:02 pm

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.

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4174
Joined: Sun Jan 07, 2007 9:12 pm

Re: Gripes with Livecode

Post by bn » Mon Jan 06, 2014 8:29 pm

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 ""

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Gripes with Livecode

Post by jacque » Mon Jan 06, 2014 8:52 pm

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.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4174
Joined: Sun Jan 07, 2007 9:12 pm

Re: Gripes with Livecode

Post by bn » Mon Jan 06, 2014 9:03 pm

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
Attachments
bnZap202fromClipboard.livecode.zip
(1.13 KiB) Downloaded 209 times

carel
Posts: 58
Joined: Mon Jul 29, 2013 2:49 pm

Re: Gripes with Livecode

Post by carel » Tue Jan 07, 2014 5:16 pm

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

keram
Posts: 340
Joined: Fri Nov 08, 2013 4:22 am

Re: Gripes with Livecode

Post by keram » Wed Jan 08, 2014 3:10 am

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
Using the latest stable version of LC Community 6.7.x on Win 7 Home Premium, 64bit

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10332
Joined: Wed May 06, 2009 2:28 pm

Re: Gripes with Livecode

Post by dunbarx » Wed Jan 08, 2014 4:17 am

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

Post Reply