Home Forums XMetaL Tips and Tricks Tip: Getting between closing tags in Normal View Reply To: Tip: Getting between closing tags in Normal View

Derek Read

Reply to: Tip: Getting between closing tags in Normal View

I feel for people that want to work in Normal view but that have run into this limitation. David's macro looks like a good workaround to me. Ideally I'd like to see us extend the standard UI to do this without needing to do this type of workaround. The decision to stop people from moving their cursor (insertion point) in Normal view into a location that does not permit text is not clear to me and was made long ago (and one of the things we try to strive for is backward compatibility). However, one of the best things about XMetaL is that because it is so customizable (we're currently way over 1000 APIs) most of the time it lets you “fix” things you don't like about it.

My Alternative Solution: I have a macro that could be integrated into any customization fairly easily. I'd like to perfect it a little more before posting (and technically I'm on vacation right now so shouldn't even be sneaking peeks here, my family would not approve 😉 I think it can be made to work for any DTD at the application-level (perhaps with a little bit of macro trickery).

The macro adds three new sub-menus to the context menu:
1) Insert Element Here
2) Insert Element After
3) Attributes

Insert Element: Basically identical to the Element List it lists as sub-items all the elements that can be validly inserted at the current position. I did this because I like to work close to my content and so I don't need to move my eyes back and forth to the Element List. It also lets me keep the Element List closed, giving me more screen real estate for my documents. Selecting any element listed in this menu inserts it at the current position just like the Element List.

Insert Element After: Exactly the same as “Insert Element” except that it lists items that can be inserted immediately after the current element (right after the closing ) and inserts them there when you select one. This is an alternative solution to David's though at the moment it only solves his exact scenario as described but has a few other limitations. It does let you insert HERE for example.

Attributes: Same idea as the first two except this lists all attributes allowed for the current element along with any value that is currently set (identical to the Attribute Inspector). Clicking on an attribute that allows text (typically CDATA) shows a simple prompt dialog (text box popup) that allows you to set, remove and change whatever the current value is. For attributes that are defined as enumerated lists another sub-menu listing allowed values (according to the DTD) appears. This menu lets you select from one of the items to set it, and if something is already set an additional item is listed at the top that lets you remove the attribute. Items with fixed values in the DTD are simply displayed and cannot be altered. Basically, I've moved the Attribute Inspector to the Context Menu. Perhaps not a big deal, except that (again) you're editing stuff “in context” so you don't need to move your eyes as much (or your mouse if you use the mouse) as well as letting you keep the Attribute Inspector closed to give you more document editing space.

I'll try to remember to post this when I get back to work (please remind me in early January if you don't see anything here shortly after January 5th).

Happy Holidays!