[REBOL] Re: dirty editor
From: gerardcote:sympatico:ca at: 30-Jun-2002 10:39
Hello Jim and Gregg,
Just for sake of helping everyone (be it a newbie or not) that needs some way to get
a similar information, here is the way I asked
myself how I could get more information when Jim asked Gregg - sort of personal challenge
:
> << (Also, how do I see the code for the editor built into Rebol. >>
May be the process I used to get my answer is not the only one that can be used but it
worked and I would share it with others that
didn't think about it already. It could also serve as a basis for discussion about the
differences there are between the way Gregg
did it and others too.
Here is my short work session tracing my way of doing things :
>> help edit
Found these words:
ctx-edit (block)
editor (function)
>> source editor
editor: func [file /local tmp][
either exists? tmp: view-root/desktop/scripts/edit.r [do/args tmp file] [
if block? ctx-edit [ctx-edit: context ctx-edit]
ctx-edit/view-file file
]
]
>> ctx-edit
== [
prefs: view-root/edit-prefs.r
dirty-edit: false
this-file: none
this-app: none
t1: s1: h1: f1: none
... <-- Here REBOL seems to report
a truncated information !!!
>> print type? ctx-edit
block
>> probe ctx-edit <-- This way of doing will
clearly reveal the internals of the
ctx-edit BLOCK
[
prefs: view-root/edit-prefs.r
dirty-edit: false
this-file: none
this-app: none
t1: s1: h1: f1: none
edit-prefs: context [
offset: 40x40
size: 640x480
wrap: on
]
ed-lo: layout/offset [
style tx vtext bold 40x22 font [colors: [0.0.0 200.200.200]] middle center
size 640x320 origin 0 space 0 across
... <---
Here I cut the listing myself just to
keep it short
Here is the solution offered by Gregg for discussion purposes only :
> probe get in ctx-text 'edit-text
>
I know this one has to do with "contexts" but how does it differ from mine?
Is there more to know about this way of doing things that could be of interest to me
and others too that I didn't find yet ?
What is the impact of requiring the content of ctx-text by the way of the "get in" instead
of probing it directly as I did?
I don't see any real difference here but may be in other situations it could be different
...
Just one more thing.
The last time I asked VIEW to "print block? ctx-edit" the answer was not "true". ?
Can it really be so or did I goofed my VIEW somewhere ? For which situation can ctx-edit
not be a BLOCK if this is possible?
I think it must effectively be possible for "ctx-edit" to not be a BLOCK because of the
test the EDITOR function is doing about it.
But whatever is the reason for doing so this doesn't answer my question either.
Thanks for any explanation (or where I can find one),
Gerard