Home Forums General XMetaL Discussion MaxLineLength in CTM Reply To: MaxLineLength in CTM

Derek Read

Reply to: MaxLineLength in CTM

In theory there should be no limit and to the best of my understanding there is not, but it depends on what you are doing and the behavior you expect. If you never enter Plain Text view you should never experience any issues (again, in theory). In practice I would encourage Pretty Printing of some kind to be enabled if just for the benefit of any humans that may wish to read the XML source.

If you do work in Plain Text view there is a limitation I refer to (jokingly) as the “M*A*S*H” issue. When viewing a document in Plain Text view, if a particular line is longer than 4077 characters that line may not be visible, but *just* in Plain Text view. The content is there, saves properly and everything else is fine, you just may not be able to interact with it in Plain Text view or you may not be able to get to the end of the line or similar issues. The other views (TagsOn and Normal) where we expect 95% of users to spend 95% (or more) of their time, are unaffected by this limitation.

This is a problem we have yet to address because it does not generally cause issues that cannot be worked around by setting pretty printing options or avoiding the use of Plain Text view (many customizations actually entirely disable Plain Text view using the Application.DisablePlainTextView API to make it harder for authors to create invalid documents).

Another issue is when any particular line exceeds 10,239 characters. In this case you will see the following message if you switch to Plain Text view and you do not have any Pretty Printing settings enabled that will cause that line to wrap (remembering that Pretty Printing is only applied when saving from TagsOn and Normal view or when you switch from those views to Plain Text view):

There are one or more lines in this document that are too long
to be displayed. They have been broken into smaller lines.

You can restore the document to its original condition
by choosing 'Undo' from the Edit menu.

To avoid this problem in the future, you can enable text layout
in the Customizations settings under the Tools menu.

Also note that Pretty Printing is not applied if you are opening documents directly into Plain Text view (the setting for which view to open into by default is in Tools > Options on the View tab).

There is no true workaround for this except to enable Pretty Printing aka “text layout”  to avoid lines of this length (note that pretty printing, aka “text layout” used to be done directly in XMetaL Author prior to version 4 which is why that last sentence is there). Again, if you never use Plain Text view you should never see this message.

Both of the above may also be affected by the Plain Text view settings in Tools > Options in the section for “Line Wrapping” (which introduces “soft” or “virtual” line wrapping while you are in Plain Text view and does not actually affect the XML source). So, depending on those settings you may see slightly different behaviors.

If you use XMetaL Developer to edit CTM files then (depending on the XMetaL Developer version) you may be told that the maximum value for is 4077. This message is there purely to help people that might have users working in Plain Text view avoid the first limitation noted above.

If you are working with XMetaL Author 6.0 and up we have introduced a new Pretty Printing setting that lets you  override the setting for specific elements, so that you can set to a preferred value (possibly something relatively short like 80 or whatever) and then tell XMetaL to ignore that for specific elements. This new setting is optionally set inside for each in the CTM file and tells XMetaL to ignore the value just for that element only. If you are editing the CTM file directly (sounds like you are) then the setting is: . If you are working in XMetaL Developer 6.0 the setting is exposed in the Properties window. This setting is used in our DITA customization for the DITA element to work around some limitations that the DITA Open Toolkit has when text in this element is line wrapped.

Note that this is different from the setting which is typically used for elements where white-space is relevant (such as elements that will contain blocks of programming code).