Formatted text not saved consistently

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

JackD
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 28
Joined: Sat Mar 14, 2009 3:17 am

Formatted text not saved consistently

Post by JackD » Wed Nov 14, 2012 4:36 am

Is anyone else having problems with formatted text changing when a stack is saved? I have a stack with several fields that have a lot of mixed formatted text including plain, italics, bold, and different sizes. Sometimes when I make a few edits and save the stack, much of the formatting is changed when I reopen it: italics disappears, italics changes to bold, extra sections become bold, etc. I've created a simpler stack with fewer cards and just had lots of extra text become bold when I added a few strings of plain text in various places. When I look at the HTMLText of the fields it looks correct BEFORE I save it but on reopening, the formatting may have changed and the HTMLText reflects the changed content. Does the text get stored as styledText in a .livecode file? I've looked at the .livecode file in a text editor but can't make sense of how it is stored - sections of plain text that match what is in the stack and then sections with undecipherable strings of characters. The best solution I've come up with is to maintain the text in an HTML file and then import it intoLiveCode (set the HTMLText of field... to ...). The problem is that I haven't gotten the HTML file perfect and continue to find problems in the stack that need correcting. Shouldn't I be able to edit formatted text in a stack?
27" iMac, OS X 10.13
iPad 3, iPad Pro, iPhone 4s, iPhone 6, LG Optimus L9 phone, Samsung Galaxy Camera
LiveCode 8.1.9

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Formatted text not saved consistently

Post by Mark » Wed Nov 14, 2012 11:14 am

Hi,

If your simple stack contains no scripts whatsoever, then this sounds like a bug. I'd say report it to RunRev.

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

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

Re: Formatted text not saved consistently

Post by jacque » Thu Nov 15, 2012 6:37 pm

I've never had this happen. As Mark suggests, it may be script-related. Can you reproduce the problem in a new, blank stack with a single field? If it works correctly there, then do you have any scripts in your main stack that deal with text?
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

JackD
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 28
Joined: Sat Mar 14, 2009 3:17 am

Re: Formatted text not saved consistently

Post by JackD » Fri Nov 16, 2012 8:10 am

I did create a simplified stack that has failed after a couple of edit sessions. It is possible to make a few changes and have it save correctly. It has 2 fields and the only scripts are in buttons for next and previous cards.
Attachments
testFormat9.livecode.zip
(8.47 KiB) Downloaded 323 times
27" iMac, OS X 10.13
iPad 3, iPad Pro, iPhone 4s, iPhone 6, LG Optimus L9 phone, Samsung Galaxy Camera
LiveCode 8.1.9

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

Re: Formatted text not saved consistently

Post by jacque » Fri Nov 16, 2012 7:33 pm

Thanks for the example, I just made several edits but it seems to work okay. You do have another script in the field that sets italic on a selection but that worked for me too. Is there something else I need to do besides changing the text and navigating around cards?

What version of LiveCode do you use? Maybe that matters.

If anything, I'd suspect the field script. You might want to change the command from "type" to something like this:

Code: Select all

set the textstyle of the selection to "italic"
Maybe the type command is interfering, though I didn't have any trouble with it.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

JackD
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 28
Joined: Sat Mar 14, 2009 3:17 am

Re: Formatted text not saved consistently

Post by JackD » Tue Nov 20, 2012 6:43 pm

Thanks for checking that out Jacque. Sometimes it works properly for me too. Saving a stack, closing and removing from memory, and reopening the stack often shows problems that are not apparent immediately. Other than that, just changing text SOMETIMES causes formatting changes. I'm using LiveCode 5.5.3 now but this also happened in previous versions as well as in the Windows version. I had forgotten about the field script for italics but formatting changes do happen without using it.
27" iMac, OS X 10.13
iPad 3, iPad Pro, iPhone 4s, iPhone 6, LG Optimus L9 phone, Samsung Galaxy Camera
LiveCode 8.1.9

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

Re: Formatted text not saved consistently

Post by bn » Wed Nov 21, 2012 12:45 am

Hi Jack,

I can confirm your observation of changing formatting.
I opened a fresh copy of your stack and just went to card 2, saved the stack although I did not change anything. Quit Livecode, start LiveCode and open the stack: the format changed.
Bildschirmfoto 2012-11-21 um 00.14.30.png
original stack
Bildschirmfoto 2012-11-21 um 00.30.48.png
after saving stack from card 2
This was reproducible every time when starting from a fresh copy of the stack.

It would be nice if someone could confirm this recipe.

This looks a lot like a bug. Maybe the fact that it is a background group has to do with it?, No idea really.

Livecode 5.5.3, MacOSX 10.6.8.

Kind regards
Bernd

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

Re: Formatted text not saved consistently

Post by jacque » Wed Nov 21, 2012 4:56 am

Good recipe, Bernd, it does that for me too.

I see the field has its textsize set to 18. After the save, that's the size the text becomes. It looks like there are some problems with the new field properties and inheritance.

Here is the htmltext of the original, followed by the htmltext of the saved version. Quite a lot has changed:

Code: Select all

<p><i><b>Artemisia borealis</b></i> Pall. <b>var. <i>wormskioldii</i></b> Besser*</p>
<p><font size="14">Wormskiold's northern wormwood </font></p>
<p><font size="14">Synonym: <i><b>Artemisia campestris</b></i> L. <b>ssp. <i>borealis</i></b> (Pall.) H.M. Hall & Clem. <b>var. <i>wormskioldii</i></b><i> </i>(Bess.) Cronquist</font></p>
<p><font size="14">Asteraceae - aster family</font></p>
<p><b><font size="14">Status</font></b><font size="14">: state endangered, federal candidate, USFS and BLM sensitive</font></p>
<p><b><font size="14">Rank</font></b><font size="14">: G5T1 / S1</font></p>


<p><i><b>Artemisia borealis</b></i> Pall. <b>var. <i>wormskioldii</i></b> Besser*</p>
<p><i><b><font size="18">Wormskiold's northern wormwood </font></b></i></p>
<p><i><b><font size="18">Synonym: Artemisia campestris L. ssp. borealis (Pall.) H.M. Hall & Clem. var. wormskioldii (Bess.) Cronquist</font></b></i></p>
<p><i><b><font size="18">Asteraceae - aster family</font></b></i></p>
<p><i><b><font size="18">Status: state endangered, federal candidate, USFS and BLM sensitive</font></b></i></p>
<p><i><b><font size="18">Rank: G5T1 / S1</font></b></i></p>
Oddly, card 2 saves correctly and that is the one I was on when I saved the stack. So your guess about background fields may be correct, it seems the text translation isn't working on non-current cards.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

JackD
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 28
Joined: Sat Mar 14, 2009 3:17 am

Re: Formatted text not saved consistently

Post by JackD » Wed Nov 21, 2012 7:39 am

Thanks for verifying this Bernd & Jacque. I've had problems getting something that is consistently reproducible. I was working with my main stack today and locking the text in a card field caused formatting changes in 2 background fields. Do I need to be a member of the Developer Program to submit a bug report on this?
27" iMac, OS X 10.13
iPad 3, iPad Pro, iPhone 4s, iPhone 6, LG Optimus L9 phone, Samsung Galaxy Camera
LiveCode 8.1.9

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

Re: Formatted text not saved consistently

Post by bn » Wed Nov 21, 2012 2:15 pm

Hi Jack,

basically you can report a bug to support at runrev, using bug in the headline.

To report a bug to the "Quality Control Center" directly with example stack etc. you have to have a subscription to the developer program.

Maybe Jacque will want to report this. She is highly knowledgeable and respected. And she found the difference in the htmlText. And she knows what the team expects the report to look like. This all helps the team to fix the bug as soon as possible.

Actually I think this is a very serious bug that absolutely has to be fixed immediately. I would call it a blocker.

Kind Regards
Bernd

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

Re: Formatted text not saved consistently

Post by Klaus » Wed Nov 21, 2012 2:23 pm

Or just send it to: bugs@runrev.com 8)

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

Re: Formatted text not saved consistently

Post by jacque » Wed Nov 21, 2012 8:16 pm

I can report it but not till after the Thanksgiving holiday here in the U.S. -- I'm cooking for a crowd today and tomorrow. It's probably best to send it to support, but if you don't, just post a note here and I'll see it and report it for you.

Right now I'm just doing a quick pass through the forums and then it is back to the kitchen. :)
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: Formatted text not saved consistently

Post by bn » Wed Nov 21, 2012 8:45 pm

OK, the turkey wins :)

I filed this as
Bug 10558
in the quality control center. (QCC)

I think it is the fastest and easiest way to get the attention of the engineers. No additional steps necessary.

I will post here if I get any news.

Others with access to QCC might want to add comments to the bug.

Kind regards
Bernd

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

Re: Formatted text not saved consistently

Post by jacque » Thu Nov 22, 2012 5:09 am

Thanks Bernd. The turkey did win.

Image
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: Formatted text not saved consistently

Post by bn » Thu Nov 22, 2012 12:20 pm

Just a short follow-up

The Quality Control Center confirmed the bug 10558 and they are investigating it.

Amazing how fast they respond.

Kind regards
Bernd

Post Reply