1. Attn: Jame Cook re: ed.ex macro mod
- Posted by K_D_R Jan 03, 2017
- 1075 views
The following changes will allow your revised version of ed.ex to run much more efficiently under Linux/Unix
The edit to the function clean(sequence line) is absolutely necessary if you are editing a file that was created under DOS. I have posted this "bug" many, many times to no avail. If you do not make the change listed below, the CR empty lines in generic DOS code files will not be stripped and your program will not run. You will have to use some other editor to remove the CR or manually delete each offending line in edx.ex/ed.ex or you modified version of ed.ex.
-- insert at beginning of code -- immediately after declarations: constant TRUE = 1, FALSE = 0 -- insert: -- patch to fix Linux screen positioning -- I think this is J Brown's code: procedure get_real_text_starting_position() sequence sss = "" integer ccc puts(1, 27&"[6n") while 1 do ccc = get_key() if ccc = 'R' then exit end if if ccc != -1 then sss &= ccc end if end while sss = sss[3..$] sequence aa, bb aa = value(sss[1..find(';', sss)-1]) bb = value(sss[find(';', sss)+1..$]) position(aa[2], bb[2]) end procedure ifdef LINUX then get_real_text_starting_position() end ifdef -- in function clean(sequence line) -- replace if length(line) > 2 and line[$-1] = '\r' then --with: if length(line) > 1 and line[$-1] = '\r' then --
Thanks for sharing your interesting "macro enabled" version of edx.ex/ed.ex with us!
Regards, Ken