At first I thought about trying to emulate the Kedit line scope concept in full, but this change is just too difficult to implement as it touches too many areas of the Zeus code.

Not surprising.

So the safest, simplest change is to just create a new document.

Well, the next question then is how to reintegrate the changes back into the original document?

Say I have a 5,000 line file. I want to make changes on lines which have condition Y but not Z. So, I use the new dialog with an Add filter of Y and a Remove filter of Z, and I get a new buffer which has the 200 lines that meet that criteria. I now edit that buffer and make 75 changes, adding 20 new lines, deleting 50 lines, and making text changes on about 100 of them.

Now, I have to put those changes back into the original document. If I have to do that manually, it's going to be far too error prone to make it worthwhile; I'd be better off just editing the original document.

Since you say you can add a SCOPE value to the line, I recommend you add two; say, MAJOR_SCOPE and MINOR scope. By default, both would have value 0. Make both of these values accessible to the macro language(s).

I can envision the following, using the 5,000 line file example above:

1. User selects criteria Y and Z, resulting in 200 matching lines
2. Zeus sets the MAJOR_SCOPE of all lines to increase, incrementally
3. All lines are copied to new buffer, with scope values intact
4. User edits the new buffer.
5. Lines added to the new buffer have MAJOR_SCOPE as the line above, with MINOR_SCOPE incremented
6. When editing is done user can merge, and lines from the new buffer overwrite lines in the original buffer with the same MAJOR_SCOPE. Lines deleted from the new buffer are deleted from the original, and lines added are placed in the original file based on the MINOR_SCOPE.

As an example:

When the new buffer is created, it has 200 lines. The first line has MAJOR_SCOPE of 1, the second has MAJOR_SCOPE of 2, etc. All have MINOR_SCOPE of 0.

Lines are editted without changing the scope.

Lines that are added have the MAJOR_SCOPE of the line above, with new MINOR_SCOPE. So if the user added 5 lines after line 7 in the new buffer, all the new lines would have MAJOR_SCOPE of 7. The first new line would have MINOR_SCOPE of 1, the second would have MINOR_SCOPE of 2, etc.

When it comes time to remerge with the original document, it now becomes an automatic operation, Zeus can use the SCOPE values to re-insert all 200 lines back into the original document in their original position.

I am not sure what you this means

I mean that as well as using regular expressions (lines that include string "ParentClass:MethodName("), be able to specify by line ranges (ie. lines 100 to 107). That's useful when you with to make changes in a block of code such as a large subroutine which can't be defined using a regular expression. Imagine a 20,000 line FORTRAN program where you want to rewrite an 800 line FileHandler() subroutine, so you isolate it into a new buffer and perform global operations on it.