I work on a Common Lisp system (<http://trac.clozure.com/openmcl/>). The lisp has an Objective-C bridge, and there's a more-than-a-demo Cocoa IDE for it, though it is pretty rough around the edges in places.

An important part of the IDE is the editor. We're currently using an emacs-like editor called Hemlock. Hemlock is written in Common Lisp, so an editor buffer is a rich lisp data structure.

A Hemlock buffer is represented as a linked list of lines. A line is a lisp string. A lisp string is a vector of characters (represented internally as UTF-32/UCS-4 code points). This is quite different from the usual way Cocoa represents text.

Also, being an emacs-like editor, Hemlock runs user-definable commands in response to key events.

Right now, we have an NSTextStorage subclass that wraps a Hemlock buffer. However, we end up maintaining a "mirror" NSMutableAttributedString instance containing the buffer text anyway, and there's a bit of hair involved in keeping the two in sync.

On the input side of things, we subclass NSTextView and override keyDown:. From what I've read, this is usually the wrong thing to do, but we want to do our own key bindings and don't want the default key bindings getting in the way. On the other hand, we still want to use input management.

Hemlock also has its own notion of selection, which is disjoint from NSTextView's. I think we'd really like users to run (user-defined) commands in response to mouse events, too. (Custom selection behavior in different editing modes, etc.)

So, I'm really looking for advice on whether it's reasonable to keep trying to use the Cocoa text system to support text display and input, or if it would be better to make the (nontrivial) effort to write a totally custom text view in a case like this.

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to