1. 3 bug fixes for EE:CS

--=======8DC75C4=======

Hello all,

         For users of EE:CS Euphoria Editor:

         The format of LIBRARY.DOC has been changed for Euphoria 2.4=20
breaking context sensitive help.  The following 2 changes in procedure=20
context_help() in EE.EX fix this:

Be sure to backup the original files.

Carl, do you see anything wrong with this?

         Look for "-- START Bob Elia" and  "-- END Bob Elia".

global procedure context_help()

<snip>  N.B.  This is NOT the complete procedure.

         -- open the file
         file_num =3D lfnopen( env & fName & ".hlp", "r")

         -- if we can't find any of the helpfiles, we'll try the library
         if file_num =3D -1 and i =3D max_help_collisions then

             -- if your machine is slow, you might not want to search
             -- through the whole of the library...
             -- just change the "if i =3D max_help_collisions"
             --              to "if i =3D -max_help_collisions" ...

             -- try the LIBRARY
             file_num =3D lfnopen( EUDIR & "\\DOC\\LIBRARY.DOC", "r")

             if file_num =3D -1 then
                 -- still no help
                 message_box( "Editor Help",
                     "Library is unavailable." )

                 -- leave
                 return
             else
                 -- START Bob Elia Wed, Feb 26 2003  6:22:19 pm
                 -- Since Rob Craig decided to change the format of=
 LIBRARY.DOC
                 -- e.g.  (2.3 & below)   =C4=C4=C4<topic>=C4=C4=C4  is now
                 --       (2.4 & above?)  ---<topic>---
                 -- this change, and one addition below, is necessary
                 --fName =3D {196,60} & word & {62,196}
                 fName =3D '<' & word & '>'
                 -- END Bob Elia
                 hide_cursor()

                 while 1 do
                     line =3D gets(file_num)

                     if atom(line) then
                         exit -- not found! The error is caught below...
                     elsif match(fName, line) then
                         line =3D gets(file_num) -- skip blank line
                         exit -- found it!
                     end if

                 end while
             end if
         end if

         -- At this point, if a file is open, the next few lines of the file
         -- will contain the necessary information, whichever file that is.

         -- read a text file into a sequence
         hide_cursor()
         buffer =3D {}
         while file_num > 0 do

             line =3D gets(file_num)
             if atom(line) then
                 exit   -- end of .HLP file. Also catches above error.
             elsif match({196,60},line) then
                 exit -- end of help section in LIBRARY.DOC
             -- START Bob Elia
             elsif match("-------<",line) then
                 exit
             -- END Bob Elia
             else
                 line =3D detab_text( line )
                 --if not length(line) and not length(buffer) then
                 -- this 'if' ignores blank lines at the beginning
                 buffer =3D append( buffer, line )
                 --end if
             end if

         end while

         -- close the file
         if file_num > 0 then close( file_num ) end if
         if length(buffer) =3D 0 then
             buffer =3D {""}
         end if
<snip>

end procedure

--=20
****************************************************************************=
**************
This bug causes the editor to crash in the Open file, Save file and save=20
file As dialogs.

global function open_file_dialog( sequence currentDir ) in D_OPEN.E


<snip>    N.B.  This is NOT the complete procedure.

         if f =3D 3 then  -- file list
             if navigation_key( keyPress ) then

                 -- get the cursor
                 cursorAt =3D get_position()

                 -- get the selected text
                 tmp =3D list_selected_text( get_control(3) )

                 -- Wildcard?
-- START Bob Elia
             -- this was causing open dialog to fail on one-letter=
 filenames.
                 --if compare( tmp[1..2], "[*" )=3D0 then
                 if length(tmp) > 2 and compare( tmp[1..2], "[*" )=3D0 then
-- END Bob Elia
                     tmp =3D tmp[2..find(']',tmp)-1]
                     pos =3D find(' ', tmp)
                     if pos then
                         tmp =3D tmp[1..pos-1]
                     end if
                 end if

                 -- move the field to the text box
                 set_attrib( 1, DATA, tmp )
                 set_control( 1, draw_sle( get_control(1) ) )

                 -- replace the cursor
                 position( cursorAt[1], cursorAt[2] )

             end if

         elsif f =3D 4 then  -- directory list

<snip>

Make the same change in global function save_as_dialog() in D.SAVEAS.E

--=20
****************************************************************************=
**************



For the selection bug that Bernie found, here's a complete replacement for=
=20
xle_selected_text() in XLE.E:

global function xle_selected_text( sequence mle )

         -- return the selected segment of text

         sequence text
         integer this

         -- nothing selected?
         if mle[ANCHOR_COL] =3D 0 then
                 return ""
         end if

         -- current line
         this =3D current_line( mle )

         -- multi-line?
         if this !=3D mle[ANCHOR_LINE] then
         if this < mle[ANCHOR_LINE] then
                 -- cursor above line
                 return mle[ITEMS][this..mle[ANCHOR_LINE]-1]
         else
                 -- cursor below the line
                 return mle[ITEMS][mle[ANCHOR_LINE]..this-1]
         end if
         end if

         -- text in question
         text =3D mle[ITEMS][this]

         -- selected on this line?
         if mle[ANCHOR_LINE] !=3D this then
         -- not this line
         return ""
         end if

         -- no text selected?
         if mle[ANCHOR_COL] =3D 0
         or relative_anchor_position( mle ) =3D mle[CURSOR] then

         -- nothing selected
         return ""

         end if

-- START Bob Elia
         if  mle[ANCHOR_COL] > length(text) + 1 then
                 mle[ANCHOR_COL] =3D length(text) + 1
         end if
-- END Bob Elia

         -- figure out the segment from the boundaries
         if mle[ANCHOR_COL] < current_col( mle ) then
-- START Bob Elia
         --return text[mle[ANCHOR_COL]..current_col( mle )-1]
                 if current_col( mle ) > length(text) then
                         return text[mle[ANCHOR_COL]..length(text)]

                 else
                         return text[mle[ANCHOR_COL]..current_col( mle )-1]
                 end if
-- END Bob Elia
         else
                 return text[current_col( mle )..mle[ANCHOR_COL]-1]

         end if

end function
--=
 ***************************************************************************

         I use EE all the time and have been modifying it for over two=20
years so if the above changes cause a problem I'll probably find it.  I've=
=20
never submitted it because I became  afflicted with "feature-itis", adding=
=20
new features before completely fixing existing bugs.  Also, some of my=20
additions aren't as polished as I'd like.  I don't want a less stable=20
version of this venerable editor out there.

         The bug that Bernie found has never happened to me; and no one has=
=20
reported the problem with the file dialogs; ... just shows how long these=20
things can hide.

         Eventually, I will ask for testers.  Does anyone else besides=20
Bernie and a couple of others actually use EE ?

         I'm curious, Carl, would you mind sending me a list of the new=20
features you had in mind?

         As this is a VERY long post, please delete the non-relevant=20
portions if you reply.

                         Bob

--=======8DC75C4=======
Content-Type: text/plain; charset=us-ascii; x-avg=cert;
x-avg-checked=avg-ok-8C22FE4
Content-Disposition: inline


---

--=======8DC75C4=======--

new topic     » topic index » view message » categorize

2. Re: 3 bug fixes for EE:CS

I've used EE since David Cuny put out the first release...


----- Original Message -----
From: Robert Elia <bobelia200 at netzero.net>
Subject: 3 bug fixes for EE:CS



Hello all,

         For users of EE:CS Euphoria Editor:

         The format of LIBRARY.DOC has been changed for Euphoria 2.4
breaking context sensitive help.  The following 2 changes in procedure
context_help() in EE.EX fix this:

Be sure to backup the original files.

Carl, do you see anything wrong with this?

         Look for "-- START Bob Elia" and  "-- END Bob Elia".

global procedure context_help()

<snip>  N.B.  This is NOT the complete procedure.

         -- open the file
         file_num = lfnopen( env & fName & ".hlp", "r")

         -- if we can't find any of the helpfiles, we'll try the library
         if file_num = -1 and i = max_help_collisions then

             -- if your machine is slow, you might not want to search
             -- through the whole of the library...
             -- just change the "if i = max_help_collisions"
             --              to "if i = -max_help_collisions" ...

             -- try the LIBRARY
             file_num = lfnopen( EUDIR & "\\DOC\\LIBRARY.DOC", "r")

             if file_num = -1 then
                 -- still no help
                 message_box( "Editor Help",
                     "Library is unavailable." )

                 -- leave
                 return
             else
                 -- START Bob Elia Wed, Feb 26 2003  6:22:19 pm
                 -- Since Rob Craig decided to change the format of LIBRARY.DOC
                 -- e.g.  (2.3 & below)   ÄÄÄ<topic>ÄÄÄ  is now
                 --       (2.4 & above?)  ---<topic>---
                 -- this change, and one addition below, is necessary
                 --fName = {196,60} & word & {62,196}
                 fName = '<' & word & '>'
                 -- END Bob Elia
                 hide_cursor()

                 while 1 do
                     line = gets(file_num)

                     if atom(line) then
                         exit -- not found! The error is caught below...
                     elsif match(fName, line) then
                         line = gets(file_num) -- skip blank line
                         exit -- found it!
                     end if

                 end while
             end if
         end if

         -- At this point, if a file is open, the next few lines of the file
         -- will contain the necessary information, whichever file that is.

         -- read a text file into a sequence
         hide_cursor()
         buffer = {}
         while file_num > 0 do

             line = gets(file_num)
             if atom(line) then
                 exit   -- end of .HLP file. Also catches above error.
             elsif match({196,60},line) then
                 exit -- end of help section in LIBRARY.DOC
             -- START Bob Elia
             elsif match("-------<",line) then
                 exit
             -- END Bob Elia
             else
                 line = detab_text( line )
                 --if not length(line) and not length(buffer) then
                 -- this 'if' ignores blank lines at the beginning
                 buffer = append( buffer, line )
                 --end if
             end if

         end while

         -- close the file
         if file_num > 0 then close( file_num ) end if
         if length(buffer) = 0 then
             buffer = {""}
         end if
<snip>

end procedure

--
******************************************************************************************
This bug causes the editor to crash in the Open file, Save file and save
file As dialogs.

global function open_file_dialog( sequence currentDir ) in D_OPEN.E


<snip>    N.B.  This is NOT the complete procedure.

         if f = 3 then  -- file list
             if navigation_key( keyPress ) then

                 -- get the cursor
                 cursorAt = get_position()

                 -- get the selected text
                 tmp = list_selected_text( get_control(3) )

                 -- Wildcard?
-- START Bob Elia
             -- this was causing open dialog to fail on one-letter filenames.
                 --if compare( tmp[1..2], "[*" )=0 then
                 if length(tmp) > 2 and compare( tmp[1..2], "[*" )=0 then
-- END Bob Elia
                     tmp = tmp[2..find(']',tmp)-1]
                     pos = find(' ', tmp)
                     if pos then
                         tmp = tmp[1..pos-1]
                     end if
                 end if

                 -- move the field to the text box
                 set_attrib( 1, DATA, tmp )
                 set_control( 1, draw_sle( get_control(1) ) )

                 -- replace the cursor
                 position( cursorAt[1], cursorAt[2] )

             end if

         elsif f = 4 then  -- directory list

<snip>

Make the same change in global function save_as_dialog() in D.SAVEAS.E

--
******************************************************************************************



For the selection bug that Bernie found, here's a complete replacement for
xle_selected_text() in XLE.E:

global function xle_selected_text( sequence mle )

         -- return the selected segment of text

         sequence text
         integer this

         -- nothing selected?
         if mle[ANCHOR_COL] = 0 then
                 return ""
         end if

         -- current line
         this = current_line( mle )

         -- multi-line?
         if this != mle[ANCHOR_LINE] then
         if this < mle[ANCHOR_LINE] then
                 -- cursor above line
                 return mle[ITEMS][this..mle[ANCHOR_LINE]-1]
         else
                 -- cursor below the line
                 return mle[ITEMS][mle[ANCHOR_LINE]..this-1]
         end if
         end if

         -- text in question
         text = mle[ITEMS][this]

         -- selected on this line?
         if mle[ANCHOR_LINE] != this then
         -- not this line
         return ""
         end if

         -- no text selected?
         if mle[ANCHOR_COL] = 0
         or relative_anchor_position( mle ) = mle[CURSOR] then

         -- nothing selected
         return ""

         end if

-- START Bob Elia
         if  mle[ANCHOR_COL] > length(text) + 1 then
                 mle[ANCHOR_COL] = length(text) + 1
         end if
-- END Bob Elia

         -- figure out the segment from the boundaries
         if mle[ANCHOR_COL] < current_col( mle ) then
-- START Bob Elia
         --return text[mle[ANCHOR_COL]..current_col( mle )-1]
                 if current_col( mle ) > length(text) then
                         return text[mle[ANCHOR_COL]..length(text)]

                 else
                         return text[mle[ANCHOR_COL]..current_col( mle )-1]
                 end if
-- END Bob Elia
         else
                 return text[current_col( mle )..mle[ANCHOR_COL]-1]

         end if

end function
-- ***************************************************************************

         I use EE all the time and have been modifying it for over two
years so if the above changes cause a problem I'll probably find it.  I've
never submitted it because I became  afflicted with "feature-itis", adding
new features before completely fixing existing bugs.  Also, some of my
additions aren't as polished as I'd like.  I don't want a less stable
version of this venerable editor out there.

         The bug that Bernie found has never happened to me; and no one has
reported the problem with the file dialogs; ... just shows how long these
things can hide.

         Eventually, I will ask for testers.  Does anyone else besides
Bernie and a couple of others actually use EE ?

         I'm curious, Carl, would you mind sending me a list of the new
features you had in mind?

         As this is a VERY long post, please delete the non-relevant
portions if you reply.

                         Bob

==^^===============================================================
This email was sent to: g.haberek at comcast.net


TOPICA - Start your own email discussion group. FREE!



--------------------------------------------------------------------------------



---

new topic     » goto parent     » topic index » view message » categorize

3. Re: 3 bug fixes for EE:CS

Robert Elia wrote:

> Eventually, I will ask for testers.  Does anyone else besides Bernie and a
> couple of others actually use EE ?

This is one of the myriad reasons I haven't been working on it - lack of
userbase. Your changes are most welcome. David Cuny's original idea was for
people to customise EE to their liking and I was hoping that others would do
the same with mine.

> I'm curious, Carl, would you mind sending me a list of the new features
you had
> in mind?

Here's the stuff I've done or wanted to do (in order of priority) for the
EE2.3:CS1 alpha.

* [Broken/Incomplete] Make the thing run under EXW as well as EX. This needs
changes to win95fh.e (long filenames don't work under NT/2K/XP), and keys.e
(Windows specific code is needed to replace the dos_interrupt() stuff). The
to/from Windows clipboard code would need updating too.

* [Incomplete/Broken] Handling for other languages - I stole a few ideas
from the way the Crimson Editor does things and made a wild stab at getting
something working. It wasn't when I stopped playing with it.

* [Not Done] Find and fix the select-and-search bug.

* [Not Done] An Undo feature - pressing Ctrl+Z and then nothing happening is
annoying. Maybe multilevel if I figured out how to do it.

* [Done] Removed the lame project handling. I never got around to
implementing something better.

* [Done] Detect BIND at editor start-up rather than whenever the menu is
redrawn. (This is possibly implemented already in 2.2:5 - not sure)

* [Not Done] Improve F12 editor macro handling.

* [Not Done] Using allocated memory rather than sequences for files that
aren't currently being edited, the local clipboard, macros and Undo;
retrieve and store as necessary.

* [With EXW] Make it run under EXU by 'borrowing' code from David Cuny's
Linux port of the his original editor.

Bet you wish you hadn't asked. :)

Carl

new topic     » goto parent     » topic index » view message » categorize

4. Re: 3 bug fixes for EE:CS

--=======509714EB=======

At 11:58 AM 3/5/03 +0000, Carl wrote:

>
>Robert Elia wrote:
>
> > Eventually, I will ask for testers.  Does anyone else besides Bernie and a
> > couple of others actually use EE ?
>
>This is one of the myriad reasons I haven't been working on it - lack of
>userbase. Your changes are most welcome. David Cuny's original idea was for
>people to customise EE to their liking and I was hoping that others would do
>the same with mine.

Glad to hear it.

> > I'm curious, Carl, would you mind sending me a list of the new features
>you had
> > in mind?
>
>Here's the stuff I've done or wanted to do (in order of priority) for the
>EE2.3:CS1 alpha.

Thanks.


>* [Broken/Incomplete] Make the thing run under EXW as well as EX. This needs
>changes to win95fh.e (long filenames don't work under NT/2K/XP), and keys.e
>(Windows specific code is needed to replace the dos_interrupt() stuff). The
>to/from Windows clipboard code would need updating too.

This wasn't a priority for me but I can see the value.  I use 
Win98.  Perhaps someday I'll have a look at key handling in Windows.  Also, 
screen output would have to be adapted.
Irv Mullins's update to David's EE for Linux might help.

>* [Incomplete/Broken] Handling for other languages - I stole a few ideas
>from the way the Crimson Editor does things and made a wild stab at getting
>something working. It wasn't when I stopped playing with it.

While this would be nice, I decided early on that there were a lot of 
established, powerful editors out there(some with their own macro 
languages) that do this already.  Of course, I'm referring to computer 
languages.  If you mean the native language of the user, I dont think that 
would be too difficult.  Again, not a priority unless it were requested.

>* [Not Done] Find and fix the select-and-search bug.

         I added ctrl_F3 to search backwards; ...had to modify XLE.E.  Now 
search_and_replace has a bug. (: ...though I did find and fix the last 
character display bug. ):

>* [Not Done] An Undo feature - pressing Ctrl+Z and then nothing happening is
>annoying. Maybe multilevel if I figured out how to do it.

I've looked at the techniques used in a couple of editors; ...NOT a trivial 
subject. My problem is deciding first how it should behave. i.e. character 
by character or word at a time(which might use less memory).

>* [Done] Removed the lame project handling. I never got around to
>implementing something better.

I left it in if anyone wanted to use it.  What I've done is add 2 items to 
the File menu to Save or Load the state of the editor from whatever 
directory it was started from.  I use bget.e to save and restore most of 
the variables in a single file in that directory. On reload, I check the 
date and time of each file against that of the data file and warn the user 
if any file is newer.  This makes it important to maintain correct time. I 
might add an MD5 check as well. You can even save with dirty or unnamed 
files if you wish.  The reason I did it this way is because the editor now 
parses each file and builds a database  of all routines *and* variables for 
all dependent include files automatically.  It will detect the version of 
Euphoria installed and use the appropriate algorithm.  This database is 
saved along with the text of the files.  As an example, it can reload 
everything from the EE project itself, some 70 files, in half a second on 
my Celeron 455.

>* [Done] Detect BIND at editor start-up rather than whenever the menu is
>redrawn. (This is possibly implemented already in 2.2:5 - not sure)
>
>* [Not Done] Improve F12 editor macro handling.

Autotext ( or keyboard macros, I'm not sure of the proper terminology ): 
The user can define preferably short mnemonic sequences which would not 
appear by themselves and associate them with any text and most cursor 
movement keys.  Just type the "key" followed by a space and it's replaced 
by the text.  It supports the existing auto-completion and has it's own 
editor within EE.  F12 can be loaded with an entry and a new entry can be 
made from F12. I recently added the ability to make one from selected text 
but that's not yet complete.  I've rarely typed "sequence" or "global 
procedure" etc. in 14 months.  The entries are stored in the .ini file.


>* [Not Done] Using allocated memory rather than sequences for files that
>aren't currently being edited, the local clipboard, macros and Undo;
>retrieve and store as necessary.

This could be done easily, I think.  I considered it.  You could also use 
the 4 chars in one integer method from MEditor (really nice code, by the 
way).  Or Jordah's mem.e.  I have several routines which search globally in 
EE; they would have to be modified.  If you think it's important, I'll work 
on it. However, I've never had a problem; not even on an 8 MB laptop.  One 
of the first things I did was raise maxFiles from 10 to 120.  (There's a 
sorted window for open files.)  Once, just to see, I had it open new files 
until EU pooped out.  766 files on 128 MB.  The parsing feature is pretty 
compute intensive; that would become a problem before memory 
constraints.  I *have* been concerned that EE would run poorly on slower 
computers but I can't come up with a method to do incremental parsing.  Oh, 
wait, I just thought of one!  ...a lot of work.

>* [With EXW] Make it run under EXU by 'borrowing' code from David Cuny's
>Linux port of the his original editor.

         Yes but that uses puts() for all display.  I have a feature that 
wouldn't translate.  If the cursor is on a routine name (local to the 
current file or global anywhere in the project) then ctrl_space will open a 
persistent window with the name of the file and the routine  declaration so 
you can see the required parameters while still editing your file.  This 
was very hard work and is dependent on David's direct screen method.  But I 
can see a different way.  I already have some code to split the window 
horizontally like EDIT.COM.

         By the way, I *have* run older versions with some success under 
dosemu and xdosemu on Redhat 6.0 but I messed up the boot sector quite a 
while ago and haven't used it since.

>Bet you wish you hadn't asked. :)
>
>Carl

Bet you wish you hadn't replied. :)>

Bob
P.S.  It was the fact that you had improved EE that inspired me to work on 
it in the first place.  Thanks.

--=======509714EB=======
Content-Type: text/plain; charset=us-ascii; x-avg=cert;
x-avg-checked=avg-ok-79785B61
Content-Disposition: inline


---

--=======509714EB=======--

new topic     » goto parent     » topic index » view message » categorize

5. Re: 3 bug fixes for EE:CS

On 5 Mar 2003, at 11:58, Carl W. wrote:

<snip>

> * [Not Done] An Undo feature - pressing Ctrl+Z and then nothing happening is
> annoying. Maybe multilevel if I figured out how to do it.

One easy way is save the existing file to disc, then making the changes. An 
undo is then simply swapping the existing file for a previously saved file. 
Make as many saved files as you want undo levels. Save what's what in an 
ini file as you go, flush the disc buffer for each action.

<snip>

> * [Not Done] Using allocated memory rather than sequences for files that
> aren't currently being edited, the local clipboard, macros and Undo;
> retrieve and store as necessary.

Or disc files, as a user (me for instance) may load up several files over a 
meg in size. The olde dos tool Xtree wouldn't load an entire file into memory 
when reading file contents, it seems to have been written with a 640K limit in 
mind.
 
Kat

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu