'set novalue on' /* force KEXX and its way of SIGNAL ON NOVALUE */ /* Usage: [MACRO] BROWSE file */ /* Or: KEDIT file (PROFile BROWSE */ /* Example: BROWSE manual.doc */ /* Purpose: View file in "wrapped" form, lines longer than */ /* screen width are split. The path is changed to */ /* TMP, because you would (normally) not want to */ /* save this "wrapped" file. BROWSE (unlike FLOW) */ /* splits only long lines - preserving most of the */ /* original structure like tables or indentations. */ /* BROWSE used within Kedit "copies" some file and */ /* view settings like colors etc. BROWSE tries to */ /* DEFINE INITIAL.KML and to execute MACRO COLOR */ /* (resp. MONO or WINDOWS) if it's used as initial */ /* profile. */ /* Bugs: BROWSE uses PSCREEN.2() to determine the actual */ /* screen width => KeditW not yet fully supported. */ /* See also: KHELP MARGINS, KHELP WORDWRAP, KHELP FLOW */ /* Requires: Kedit 5.0 (KeditW should also work, test it) */ /* Optional: INITIAL.KML, COLOR.KEX, MONO.KEX, WINDOWS.KEX */ /* (Frank Ellermann, 2004) */ parse source . . NAME if profile() then exit EDIT( NAME ) ; call INIT if arg( 1 ) = '' then do 'emsg' NAME || ': missing file argument' ; exit 3 end 'kedit' arg( 1 ) '(PROFile' NAME ; exit rc EDIT: procedure /* -------------------------------------------- */ if initial() then do /* initialize global settings */ 'hexdisp on' ; 'reprof on' ; 'shifts on' ; 'beep on' 'nomsg define initial.kml' ; 'nomsg macro ' monitor.1() 'arbchar on' ; 'arrow off' ; 'backup temp' 'number on' ; 'wrap on' ; 'varblank on' call INIT /* save new favoured settings */ end 'editv get HEXE.0' do N = 1 to HEXE.0 /* restore any local settings */ 'editv get HEXE.' || N /* for file resp. view saved */ 'set' HEXE.N /* by procedure INIT before */ end /* -------------------------------------------- */ 'tabsin on' ; 'nomsg msg' /* expand TABs, clear lastmsg */ 'margins 2' pscreen.2() - 1 '-1' 'wordwrap on' /* screen width: right margin */ 'nomsg bottom' /* modify from bottom upwards */ do N = 10 - line.1() // 10 until focustof() if N // 10 = 0 then 'refresh' 'point .browse' ; O = curline.3() ; 'replace' 'sos leftedge' ; if O <> '' then 'text' O 'locate .browse' ; 'up' /* wrap line at right margin */ end parse value dosenv( 'TMP' ) with N ':' O if N = '' then N = 'C' ; N = N || ':' || O parse value reverse( fileid.1()) with O '\' . N = N || '\' || reverse( O ) O = fileid.1() if N <> O then do 'kedit "' || N || '" (nodefext new noprof)' if rc = 0 then 'qquit' 'kedit "' || O || '" (nodefext new)' 'fileid "' || N || '"' end 'set alt 0 0' ; 'lineflag nonew nochange ALL' 'reserved' msgline.2() attr.11() arg( 1 ) || ':' efileid.1() if lastmsg.1() <> '' then say lastmsg.1() 'cursor column' ; return 0 INIT: procedure /* -------------------------------------------- */ 'nomsg query attr' ; HEXE.1 = lastmsg.1() 'nomsg query arbchar' ; HEXE.2 = lastmsg.1() 'nomsg query arrow' ; HEXE.3 = lastmsg.1() 'nomsg query backup' ; HEXE.4 = lastmsg.1() 'nomsg query number' ; HEXE.5 = lastmsg.1() 'nomsg query varblank' ; HEXE.6 = lastmsg.1() 'nomsg query wrap' ; HEXE.7 = lastmsg.1() HEXE.0 = 7 do N = 0 to HEXE.0 ; 'editv put HEXE.' || N ; end return