• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: TextEdit oddity
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: TextEdit oddity


  • Subject: Re: TextEdit oddity
  • From: Shane Stanley <email@hidden>
  • Date: Tue, 20 May 2014 10:37:54 +1000

On 20 May 2014, at 12:37 am, koenig.yvan <email@hidden> wrote:

a bare version is :

tell application "TextEdit" to tell document 1
set leTexte to its text

set its text to (leTexte & "=azertyuiop=")

delay 0.1
set properties of its text to {font:"Menlo-Regular", size:11.0}

end tell

For most of the texts, all works well.

I just get a problem with large files.
For instance, I have one text containing 141831 characters (including space ones) the script fails
and the Events log display :


set properties of every text of document 1 to {font:"Menlo-Regular", size:11.0}
--> error number -10000


After that I can't select something in the document's window and I am forced to quit TextEdit and reopen the document which happily is correctly saved.

Am’I doing something wrong or am’I facing a bug ?

It looks like you're facing a bug. It often gives me a TextEdit crash/continue dialog:

Exception Name: NSInternalInconsistencyException
Description: -[NSLayoutManager _fillGlyphHoleForCharacterRange:startGlyphIndex:desiredNumberOfCharacters:] *** attempted glyph generation while textStorage is editing.  It is not valid to cause the layoutManager to do glyph generation while the textStorage is editing (ie the textStorage has been sent a beginEditing message without a matching endEditing.)
User Info: (null)

And I can see in Console entries like:

20/05/2014 10:13:22.696 am TextEdit[10164]: An exception was thrown during execution of an NSScriptCommand...
20/05/2014 10:13:22.696 am TextEdit[10164]: *** -[NSConcreteTextStorage attribute:atIndex:effectiveRange:]: Range or index out of bounds
20/05/2014 10:13:29.750 am TextEdit[10164]: -[NSLayoutManager _fillGlyphHoleForCharacterRange:startGlyphIndex:desiredNumberOfCharacters:] *** attempted glyph generation while textStorage is editing.  It is not valid to cause the layoutManager to do glyph generation while the textStorage is editing (ie the textStorage has been sent a beginEditing message without a matching endEditing.)

Given that it's happening when you're trying to replace the contents of the document, and given that TextEdit pretty much relies on built-in support for this sort of scripting, there may well be the same problem in other apps. So you should definitely report it.

-- 
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: TextEdit oddity
      • From: "koenig.yvan" <email@hidden>
References: 
 >TextEdit oddity (From: "koenig.yvan" <email@hidden>)

  • Prev by Date: Re: Using results of dialogs?
  • Next by Date: Re: TextEdit oddity
  • Previous by thread: TextEdit oddity
  • Next by thread: Re: TextEdit oddity
  • Index(es):
    • Date
    • Thread