Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

Folding browser & editor

 [1/7] from: al::bri::xtra::co::nz at: 23-Dec-2002 19:58


What do people think about a cgi script that would allow a browser to view and edit Rebol script, and fold blocks (and strings) open or closed? Take, for example, this fully opened view of a function (I've copied Brett Handley's recent on-error function as an example): on-error: func [ {Tries to DO a block or if an error DO handler.} [catch] block [block!] handler "If handler is a block! then ERROR, RESULT, BLOCK and HANDLER will be bound." /local result error ] [ if error? set/any 'result try block [ if block? :handler [ error: disarm result bind handler 'result ] set/any 'result do handler ] get/any 'result ] A partially closed view: on-error: func [ {Tries to DO a block or if an error DO handler.} [...] block [...] handler "..." /local result error ] [ if error? set/any 'result try block [...] get/any 'result ] A fully closed view: on-error: func [...] [...] Naturally, clicking on a "[" (open square bracket) would fold open up the block, and clicking on a "]" would fold close the block. For example, clicking on the first "[" in this view: on-error: func [...] [...] would result in this view: on-error: func [ {Tries to DO a block or if an error DO handler.} [...] block [...] handler "..." /local result error ] [...] and clicking on the first "[" would return the view back to: on-error: func [...] [...] Naturally, file! values would be hyperlinked appropriately. word! values could be tentatively hyperlinked to the script's interpretation of a word's context. This would of course fail for constructed words and words that are set with 'set. Andrew Martin ICQ: 26227169 http://valley.150m.com/

 [2/7] from: greggirwin:mindspring at: 23-Dec-2002 10:18


Hi Andrew, AM> What do people think about a cgi script that would allow a browser to view AM> and edit Rebol script, and fold blocks (and strings) open or closed? ... AM> Naturally, clicking on a "[" (open square bracket) would fold open up the AM> block, and clicking on a "]" would fold close the block. For example, AM> clicking on the first "[" in this view: Code folding editors can be pretty cool, though I've never gotten into them myself as I grew up on a different paradigm. In any case, would it be possible to detect a click anywhere on a folded block (e.g. on any part of "[...]") to expand it? It's hard to say, not having used it, but I think it might be easy to get confused if you have to click on a particular bracket to get what you want, especially if they're close. I would also think a hot-key might be a better choice, so you could have the caret anywhere in a block and hitting the key would collapse, or expand, the block it's currently in. Take this with a grain of salt since it's not my area. Maybe someone who has used lot of others will chime in. My only experience with this kind of thing is Frontier, which does it a bit differently than many others I expect since Dave Winer thinks in outlines. -- Gregg

 [3/7] from: chalz:earthlink at: 23-Dec-2002 16:03


This sounds like behavior Ammon's been touting loudly from jEdit. And I have to admit, it sounds VERY desirable, though I haven't tried jEdit yet. But why just a CGI script? Why not a full-blown editor? Aside from the fact that I think Ammon's RIDE implementation will be doing similar. ;) --Charles

 [4/7] from: ammon:addept:ws at: 23-Dec-2002 14:43


HI, I agree, Gregg. A hot key, or a system that folds more like this: example: func [... ] [... ] One set of brackets per line, then you can place a little button of sorts to expand the brackets. That is how jEdit works and I quite like it, but jEdit takes too long to open and I am constantly opening/closing files so I am mostly using REBOL's built in Editor. ;-) I just need to encap me a cute little script so that I can make it my default text editor. ;-) Enjoy!! Ammon Johnson CIO of Addept ---------- (www.addept.ws) 435.616.2322 ---------- (ammon AT addept.ws)

 [5/7] from: al:bri:xtra at: 24-Dec-2002 12:09


Charles wrote:
> But why just a CGI script? Why not a full-blown editor?
I have a cunning reason for that -- it's to allow editing over the Internet when people don't have Rebol, in situations like reviewing and editing something like a script store. I also have a stupid reason -- I know how to do Rebol/View stuff with expertise. :( Andrew Martin ICQ: 26227169 http://valley.150m.com/

 [6/7] from: chalz:earthlink at: 23-Dec-2002 19:52


> example: func [... > ] [... > ] > > One set of brackets per line, then you can place a little button of sorts to > expand the brackets. That is how jEdit works and I quite like it, but jEdit
Wouldn't it be possible, though, for the text window to sense brackets, after a fashion, 'highlight' brackets once they've been paired so that they appear, say, blue and underlined; and clicking on that blue/underlined bracket causes all within that bracket and its pair to collapse? Then, once you've got [...] or [...\r], the brackets and dots would be similarly blue/underlined, which you can click on to re-expand? I don't know about the feasibility of this, but it seems like a fair idea to me ;) However, the ability, yes, for a hot key to open and another to close, based upon cursor location, would be useful. I say one for each operation, rather than a single key, since you might have nested blocks, such as: [ [ 123 ] 456 ] If you place the cursor at 123, or one of the brackets around 123, and hit the hotkey, it would fold up that section. However, if you then wished to close up all of it, hitting the same key might pop the 123 section back open, which you don't want to do. So, anyways, just suggesting separate open&close hotkeys --Charles

 [7/7] from: chalz:earthlink at: 23-Dec-2002 19:53


Hehehe. Both good reasons, if you ask me. However, I certainly hope that any read/write access to such editor, or the console itself via a 'do' command in the CGI script, would be heavily protected. Otherwise, poof goes your system ;) --Charles