• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Use text system or totally custom text view?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Use text system or totally custom text view?


  • Subject: Use text system or totally custom text view?
  • From: R.Matthew Emerson <email@hidden>
  • Date: Tue, 3 Jun 2008 23:49:18 -0400

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 (email@hidden)

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:
This email sent to email@hidden


  • Prev by Date: Re: DTrace probe problem
  • Next by Date: Re: Manipulating images with meta-data
  • Previous by thread: Re: Opening column for edit after adding to tree controller?
  • Next by thread: 10.5 Only: If I say NO, NSOutlineView ignores cmd key, does its own thing
  • Index(es):
    • Date
    • Thread