![]() |
Pitfalls and known bugs | ![]() |
Loci exist only while typeset. The registry is filled by the typesetter and emptied when a bridge is retypeset or destroyed. id->trees therefore returns nothing for a buffer which is loaded but has not been typeset, and code which registers a locus and looks it up immediately may not find it until the next typesetting.
id->trees returns bodies, not loci. Use id->loci to obtain the locus tags.
Loci generated by macros. When the body of a locus is not accessible, its identifier is only registered as &name (inline loci get a locus box, block loci a warning). Code that searches loci by identifier must try both forms, as id-update does.
Hard identifiers are not persistent. Identifiers produced by hard-id depend on memory addresses; they must not be stored in documents or used for links between files. Use create-unique-id for that.
The visited set is global. It is shared by all buffers and never cleared during a session.
Mouse rectangles and identifiers are not matched. The editor collects the identifiers and the outlines under the mouse separately (a FIXME in update_mouse_loci), so all active loci under the mouse are highlighted together.
Labels need several passes. References are only correct after the iterations of edit_typeset_rep::typeset have converged; a reference read from Scheme right after an edit may still hold the old value.
link-vertices
is shadowed inside
link-edit.scm
. The module
defines the public (link-vertices
ln) at line 58 and later a private (link-vertices nr) at line 146, which
replaces it inside the module. Other modules see the
right function, but within
link-edit.scm
:
link-source and link-target (lines 62-66) fail with a type error;
locus-consider-link? in simple mode (line 199) calls link-source and fails, so locus-link-types (and thus Link\(\rightarrow\)Delete link) breaks in that mode;
remove-link in bidirectional mode (line 221) obtains no vertices and therefore never removes the copies of the link stored in the other loci.
Simple mode compares a string with a vertex. Even with the previous bug fixed, locus-consider-link? (link-edit.scm, lines 197-200) compares the locus identifier (a string) with (link-source ln) (a vertex (id …)), which is never equal.
The file registry forgets file names. registry-add (link-extern.scm, line 61) computes the old names with (and (registry-get id) '()), which is always (), so each new name replaces the previous ones instead of being added.
Project tables are bound once (suspected). The editor binds its global_ref, global_aux and global_att to the tables of buf->prj when it is constructed (edit_typeset.cpp, lines 39-42). project_attach (new_project.cpp, lines 37-40) changes buf->prj later without rebinding them, so a chapter attached to a project in an open view presumably keeps using its old tables until the view is recreated, and the references would dangle if the project buffer were closed first. This has not been verified at run time.
navigation-list-first-xtype works by accident. It returns (navigation-type fl) for a list fl (link-navigate.scm, line 302); since navigation-type is car, this happens to return the first navigation item, which is what the caller expects.