editor
[1/8] from: jim:clatfelter at: 27-Jun-2002 20:51
Thanks for trying to help. The script works for awhile, but I eventually
wind up with an error. This usually happens after I use the keyboard.
** Script Error: caret-xy has no value
** Where: paste
** Near: system/view/caret: offset-to-caret a1 caret-xy
The timer seems like a good way to remember the caret position. Clicking a
button when the text is dirty drops the focus on the area. The caret is
gone. I don't know why caret-xy has no value at times. It seems like it
should always have a value. Maybe the timer reads no value when the text is
dirty, though it sometimes does.
It would be nice to be able to keep the dirty flag always false.
Thanks again,
Jim
----- Original Message -----
From: Doreen Greaves <[EILLAG--worldnet--att--net]>
To: <[rebol-list--rebol--com]>
Sent: Wednesday, June 26, 2002 7:51 PM
Subject: [REBOL] editor
> this is a hack:
> <code>
<<quoted lines omitted: 39>>
> the caret disappears so you need to put it back where it was.
> timer hanger does nothing so redefining its feel wont break any other
face.
> it saves the caret position in caret-xy. (line 25)
> then in line 14 you put it back.
<<quoted lines omitted: 28>>
> [rebol-request--rebol--com] with "unsubscribe" in the
> subject, without the quotes.
-- Binary/unsupported file stripped by Listar --
-- Type: application/octet-stream
-- File: Show Desktop.scf
[2/8] from: g:santilli:tiscalinet:it at: 29-Jun-2002 14:23
Hi Jim,
On Thursday, June 27, 2002, 3:19:07 AM, you wrote:
Sorry for the delay, I've been away from home.
JC> I assume the dirty word means that the text has changed (by means of the keyboard).
Indeed.
JC> How do I disable this event
JC> function, as you suggest?
remove system/view/screen-face/feel/event-funcs
You might want to check for View's version to be sure of removing
the right event func. Also, have a look at INSERT-EVENT-FUNC and
REMOVE-EVENT-FUNC.
A different solution would be to add an event function to be
evaluated before that one and that saves the caret position; or
you could also patch that event func no to call UNFOCUS, i.e.:
>> c: second pick system/view/screen-face/feel/event-funcs 1
== [
if all [
system/view/focal-face
event/type = 'down
not within? event/offset win-offset? system/v...
>> c/4
== [
fac: system/view/focal-face
unfocus
do-face fac none
fac/dirty?: none
]
>> remove at c/4 3
== [
do-face fac none
fac/dirty?: none
]
>> probe pick system/view/screen-face/feel/event-funcs 1
func [face event /local fac][
if all [
system/view/focal-face
event/type = 'down
not within? event/offset win-offset? system/view/focal-face system/view/focal-face/size
system/view/focal-face/dirty?
] [
fac: system/view/focal-face
do-face fac none
fac/dirty?: none
]
event
]
(WARNING: not tested)
Regards,
Gabriele.
--
Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer
Amigan -- AGI L'Aquila -- REB: http://web.tiscali.it/rebol/index.r
[3/8] from: hijim:pronet at: 28-Jun-2002 19:38
One last question.
How do I look at the code in Rebol's built-in editor? I used to know how to display the
code.
Jim
[4/8] from: hijim::pronet::net at: 29-Jun-2002 18:11
Dear Gabriele,
Dear Gabriele,
remove system/view/screen-face/feel/event-funcs
Thanks very much! That's all it took. Now I can use the keyboard and the buttons and
the scroll-bar and never lose the caret. Now the find button works right. It always searches
from the caret position. Before, it began at the top of the file if it was dirty. I'll
keep all the information you gave in case I run into trouble later.
There's still one thing that's not quite right yet. I have to write a
function to update the slider when I use the cursor keys. I'll try that on my own. I'm
also going to add a delete and a backspace button. And I need buttons for html tables.
I forgot that the rebol editor is just a file (editor.r). It has some
interesting code in it -- such as keymap. That's how they code the page up and down keys
to move the slider. I think I can get that on my own. I hope!
If I get this perfected, I'm going to take out some of the personal web-page code and
submit it to the script library. I'll post it to my web site first. Adding buttons should
be easy for anyone who wants code with their own preferences. I don't know what other
features would be needed for a good program editor. All I've heard is color coding the
syntax. That's nice, but I don't miss it much.
Anyway, thanks again!
Sincerely,
Jim
[5/8] from: jim:clatfelter at: 29-Jun-2002 18:00
Re: editor
Dear Gabriele,
remove system/view/screen-face/feel/event-funcs
Thanks very much! That's all it took. Now I can use the keyboard and the
buttons and the scroll-bar and never lose the caret. Now the find button
works right. It always searches from the caret position. Before, it began at
the top of the file if it was dirty. I'll keep all the information you gave
in case I run into trouble later.
There's still one thing that's not quite right yet. I have to write a
function to update the slider when I use the cursor keys. I'll try that on
my own. I'm also going to add a delete and a backspace button. And I need
buttons for html tables.
I forgot that the rebol editor is just a file (editor.r). It has some
interesting code in it -- such as keymap. That's how they code the page up
and down keys to move the slider. I think I can get that on my own. I hope!
If I get this perfected, I'm going to take out some of the personal web-page
code and submit it to the script library. I'll post it to my web site first.
Adding buttons should be easy for anyone who wants code with their own
preferences. I don't know what other features would be needed for a good
program editor. All I've heard is color coding the syntax. That's nice, but
I don't miss it much.
Anyway, thanks again!
Sincerely,
Jim
[6/8] from: hijim:pronet at: 29-Jun-2002 21:12
http://www.clatfelter.net/a-a-edit.r
I've added a few features to the editor and posted it at the url above. I still need
to add some html table tags. And the scroll bar doesn't tie into the page-up and page-down
or cursor-up and cursor-down keys. I think that's beyond me. If anyone can see a solution,
I'll be glad to try it.
I think *remove system/view/screen-face/feel/event-funcs* may have disabled keymap. Maybe
a timer function could update the scrollbar and the lines function. I'll try that idea
tomorrow.
Thanks for all the help,
Jim
[7/8] from: gerardcote:sympatico:ca at: 30-Jun-2002 10:56
Hi Jim,
You did an excellent job of dismantling all this code. In a recent reply I explained
how I found the Editor code which I suspected
to be refered in the REBOL system help.
Let's switch to another topic now :
=======================
After trying your a-a-edit.r script I found myself a bit disoriented on how to use it
and I didn't want to use much time learning by
doing on a trial and error basis. do you have some basic doc about the way to use it
or at least a small description about how it
works and what is the goal of it.
And again in a last direction :
> I don't know what other features would be needed for a good
> program editor. All I've heard is color coding the syntax. That's nice, but
> I don't miss it much.
>
Did you hear about the REEMACS or (REM) editor Cal Dixon seemed to submit to the REBOL
community near the end of september 2000. I
found an archived article in the ML yesterday he wrot about it and I tried to contact
him by his old email addresses - but I don't
have received an answer from him yet. Hope he always use his old adresses and is interested
sharing some ideas and code with us
all - if any other is interested by his work.
His editor was completely REBOL based and worked only in CONSOLE mode but it seemed to
work well also under VIEW (presumably in
console mode too).
I don't know if this can be of some use to you but at least you know that there was a
REBOL EDITOR that existed once.
Regards,
Gerard
[8/8] from: hijim:pronet at: 14-Jul-2002 17:38
Thanks to Gabriele and Romano, I've been able to get the buttons to work without losing
focus on the text area, to get the slider tied into the page-up and page-down keys, and
to keep the number of lines in the file automatically and correctly listed. Those were
my last problems. I didn't think I'd get them all resolved. (I'm sure there's room for
improvement in the slide function, but it's much better than it was.)
I've posted the updated editor at: http://www.clatfelter.net/a-a-wysiwyg.r
That's just a temporary name. It prints on the printer exactly what's on the screen (70
characters), so I called it wysiwyg -- about as wysiwyg as a text file can get.
The key routine that does all of this is:
my-area: area para [ ]
500x490 my-file white white font-name font-fixed wrap
feel [
engage: func [f a e] [
ctx-text/edit/engage f a e
if e/key = 'page-down [slide]
if e/key = 'page-up [slide]
my-area/dirty?: false
get-lines
]
]
Thanks for all the help. Now I can move on to other programs and stop obsessing on this
one.
Jim
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted