5 ms·
Surprised nobody's mentioned Boxer, or some other boxes-in-boxes representation http://web.media.mit.edu/~mres/papers/boxer.pdf http://web.media.mit.edu/~mres/p
by chriswarbo 10y ago
Surprised nobody's mentioned Boxer, or some other boxes-in-boxes representation http://web.media.mit.edu/~mres/papers/boxer.pdf http://web.media.mit.edu/~mres/papers/boxer.pdf
Blockly ( https://developers.google.com/blockly https://developers.google.com/blockly ) is also similar, but I think it's a bit too specific:
- Only one type of block is needed, to represent a generic "node" in the tree. Distinctions can be added by plugins, if desired for some particular language.
- The idea of "interlocking" can be discarded, since a general tree editor should allow arbitrary edits to arbitrary trees (in the same way that a general text editor should allow any text to be inserted anywhere in a file/buffer). Plugins can add it back for particular languages.
- Nesting should be the only relationship; it subsumes "sitting beside" (like Blockly assignments) or "wrapping around" (blockly loops).
- No need to distinguish between editable/immutable values; everything is editable.
As a baby step towards the author's goal, how about an s-expression editor which displays boxes-in-boxes instead of parentheses? The editing commands could be exactly the same as e.g. Emacs+paredit, the only difference would be that indentation begins at the left edge of the current box, rather than at the left edge of the screen. For example, we would have to discard the indentation of an expression like:
(foo (bar baz) (quux
foobar))
Instead we would align "foobar" to be in the same box as "quux", e.g.
+-------------------------+
| +-------+ +---------+|
|foo |bar baz| |quux ||
| +-------+ | foobar||
| +---------+|
+-------------------------+
Note that I don't recommend using ASCII to draw the boxes (except maybe as a proof-of-concept). Once we have such an editor, we could start to extend it with features like coloured boxes for syntax colouring, structure-checkers (e.g. "if" should have 3 children, etc.).
More radical extensions can then support pulling the boxes out into a more traditional tree structure.
- junke 10y agoIt's funny how bad I really want to go to the foobar line and hit Tab (or M-q near it).
- chriswarbo 10y agoAfter some Googling I've come across http://foldr.org/~michaelw/emacs/ http://foldr.org/~michaelw/emacs/ which includes a hack for giving nested s-expressions different colours and hiding the parentheses. This sort of "tree view", combined with paredit's "tree editing", might go some way towards faking a tree editor. Maybe this could be combined with https://github.com/jacksonrayhamilton/context-coloring https://github.com/jacksonrayhamilton/context-coloring and either https://en.wikipedia.org/wiki/Semigraphics https://en.wikipedia.org/wiki/Semigraphics or the new cairo support for drawing pretty borders?