On Saturday, February 4, 2017 at 10:47:47 AM UTC-6, Terry Brown wrote:

Nonetheless, I don't think we should insert weird unicode chars into 
> peoples files, and I'm not sure it serves any purpose, seeing the char. 
> by itself carries no info.  The file should only every contain the 
> markup (<img...> or ![alt text](url) or whatever). 
>

Hmm. Let's put this question on the back burner until a prototype is 
working. But I do have a few comments:

1. There is nothing at all "weird" about unicode code point U+FFFC (OBJECT 
REPLACEMENT CHARACTER). It's perfectly valid unicode and QTextEdit seems to 
use it appropriately.

2. Yes, Leo's atFile write code could strip it. However, recent researches 
(see below) indicate that it will turn out to be a useful placeholder.

3. If we use explicit markup, then somehow that markup must be 
hidden/unhidden. But if we simply insert images, then (eventually) 
everything will "just work" (tm).

*Recent Researches*

QTextDocument <http://doc.qt.io/qt-5/qtextdocument.html> seems to work as 
expected. From QTextDocument.resource() 
<http://doc.qt.io/qt-5/qtextdocument.html#resource>: 

QQQQQ
Returns data of the specified type from the resource with the given name.
    
This function is called by the rich text engine to request data that isn't 
directly stored by QTextDocument, but still associated with it. For 
example, images are referenced indirectly *by the name attribute* [emphasis 
mine] of a QTextImageFormat object.
    
Resources are cached internally in the document. If a resource can not be 
found in the cache, loadResource is called to try to load the resource. 
loadResource should then use addResource to add the resource to the cache.
QQQQQ

So Leo must refresh the resource caches when switching nodes, using uA's. 
That will probably be done in the tree.select logic just before calling 
setAllText, the call that triggers the colorizer.

Imo, this is an experiment well worth doing. We can debate about whether to 
add placeholder unicode characters later, but I see no reason not to do 
so.  After all, the user *did* insert a picture.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.

Reply via email to