-----------------------------------------------------------------------------
|							  Config!Z										|
|		 Copyright (C) 1986-92 Rick Stiles.  All rights reserved.			|
-----------------------------------------------------------------------------

======= NEW or CHANGED CMDS in Uedit V3.0 =======


HYPER TEXT in Config!H has been rewritten.

INCLUDE Config!H here when considering cmds that have been modified for V3.0.

*************************************
N-variables used:
n0-n19 scratch numbers

Buffers used:
buf51-54	scratch buffers

buf37	copied columnar text
buf38	directory names
buf41	swap buf
buf43	filename buf
buf45	UNDO buffer
buf46	invert buf
buf47	hilite buf
buf48	replace text
buf49	search string
buf99	stack buf

*************************************

<defines:
define(N_0 ,n0)
define(N_1 ,n1)
define(N_2 ,n2)
define(N_3 ,n3)
define(N_4 ,n4)
define(N_5 ,n5)
define(N_6 ,n6)
define(N_7 ,n7)
define(N_8 ,n8)
define(N_9 ,n9)
define(N_10 ,n10)
define(N_11 ,n11)
define(N_12 ,n12)
define(N_13 ,n13)
define(N_14 ,n14)
define(N_15 ,n15)
define(N_16 ,n16)
define(N_17 ,n17)
define(N_18 ,n18)
define(n_19 ,n19)

define(B_0 ,buf50)
define(B_1 ,buf51)
define(B_2 ,buf52)
define(B_3 ,buf53)
define(B_4 ,buf54)

define(COLUMNAR_BUF ,buf37)
define(DIR_NAMES	,buf38)
define(SWAP_BUF ,buf41)
define(FILE_NAME	,buf43)
define(UNDO_BUF ,buf45)
define(INVERT_BUF	,buf46)
define(HILITE_BUF	,buf47)
define(REPLACE_TXT ,buf48)
define(SEARCH_STR	,buf49)
define(BUF_99	,buf99)

define(BSTACK_99	,buf99) .. note buf99 isn't really used
define(NSTACK_99	,n99)	.. note n99 isn't really used

define(Eat_MouseUp_Input	,624)
>

Multiple document search
<alt-f9:
	equateNum(N_4,curFile)
	equateLoc(curFile,locA,atCursor)

	while (not runKey(normal-f9)) {
		moveCursor(curFile,locA)
		updateDisplay
		toggle(curFile)
		if (eqNum(N_4,curFile)) returnFalse
		equateLoc(curFile,locA,atCursor)
		moveCursor(curFile,sFile)
	}
>

Replace matched region with replace text, then search fwd in all files
<ctl-f10:
	if (eqLoc(curFile,sInvert,eInvert)) returnFalse
	clearRgn(curFile,invert)
	insertRgn(curFile,sInvert,REPLACE_TXT,all)
	runKey(alt-f9) >

Replace and fwd search-replace in all files until search fails
<shftAlt-f10: while(runKey(ctl-f10)) nothing >

Set up conditions to fold a file
<lAmiga-\:
	define(LHS_COLOR,0)
	define(RHS_COLOR,9)
	define(TITLE_COLOR,9)
	define(CMT_COLOR,9)
	define(BG_COLOR,0)
	putMsg("")

	text("",0,0,BG_COLOR,-2)

	while (nothing) {
label(4)
		gosub label(0) .. show current tests on LHS
		gosub label(1) .. show options on RHS
		putMsg("Testing step [1-16] (0=quit):")
		inputNum(N_18)
		if (geNum(0,N_18)) goto label(3)
		if (gtNum(17,N_18)) {
			putMsg("Testing option [1-15] (0=back,-1=clear step):")
			inputNum(N_7)
			if (eqNum(N_7,0)) goto label(4)
			if (gtNum(0,N_7)) { setFold(N_18,0,0,0) goto label(4) }
			if (geNum(N_7,16)) goto label(4)
			freeBuf(B_4)
			equateNum(N_8,0)
			if (gtNum(8,N_7)) { 		.. 1-7, need num
				putMsg("X=indent or X=length value [0-130] (-1=back)")
				inputNum(N_8)
				if (gtNum(0,N_8)) goto label(4)
				if (gtNum(N_8,130)) equateNum(N_8,130)
			} else if (gtNum(11,N_7)) { .. 8-10 need 1-4 chars
				putMsg("X = 1-4 characters:")
				if (!inputString(B_4)) goto label(4)
				fileSize(B_4,N_4)
				if (eqNum(N_4,0)) goto label(4)
			} else {					.. 11-15 need 2 chars
				putMsg("X = 2 characters for range or brackets:")
				if (!inputString(B_4)) goto label(4)
				fileSize(B_4,N_4)
				if (!eqNum(N_4,2)) goto label(4)
			}
			putMsg("SKA value (0=skip, 1=keep, 2=AND with next step):")
			inputNum(N_9)
			if (gtNum(0,N_9) | gtNum(N_9,2)) goto label(4)
			if (gtNum(8,N_7)) setFold(N_18,N_7,N_8,N_9)
			else setFold(N_18,N_7,B_4,N_9)
		}
	}
label(3)
	fullRefresh
	putMsg(" ") putMsg("")
	return

label(1) .. SUBROUTINE: display test options on RHS
	text("Testing Options",3,46,TITLE_COLOR,0)
	do (N_0,1,15) {
		gosub label(2)
		add(N_10,N_0,3)
		if (gtNum(N_0,9)) text(N_0,N_10,46,RHS_COLOR,0)
		else text(N_0,N_10,47,RHS_COLOR,0)
		text(B_4,N_10,50,RHS_COLOR,0)
	}
	incNum(N_10)
	text("(Strings use X = \"abcd\" ...)",N_10,48,CMT_COLOR,0)
	incNum(N_10)
	text("(Ranges use X = \"AZ\", \"09\" ...)",N_10,48,CMT_COLOR,0)
	incNum(N_10)
	text("(Rgns use X = \"[]\", \"{}\" ...)",N_10,48,CMT_COLOR,0)
	return

label(0) .. SUBROUTINE: display current steps on LHS
	text("Current Testing Steps",3,1,TITLE_COLOR,0)
	text("X",3,34,TITLE_COLOR,0)
	text("SKA",3,40,TITLE_COLOR,0)
	do (N_3,1,16) {
		getFold(N_3,N_0,N_1,B_3,N_2)
		gosub label(2)
		add(N_10,N_3,3)
		if (gtNum(N_3,9)) text(N_3,N_10,1,CMT_COLOR,0)
		else text(N_3,N_10,2,CMT_COLOR,0)
		equateNum(N_11,31)
		if (!eqNum(N_0,0)) {
			if (gtNum(N_3,9)) equateNum(N_11,30)
			text(B_4,N_10,4,LHS_COLOR,N_11)
			if (!eqNum(N_0,1)) {
				if (gtNum(N_0,7)) text(B_3,N_10,34,LHS_COLOR,0)
				else text(N_1,N_10,34,LHS_COLOR,0)
			}
			if (eqNum(N_2,0)) text("Skip",N_10,40,LHS_COLOR,0)
			else
			if (eqNum(N_2,1)) text("Keep",N_10,40,LHS_COLOR,0)
			else
			if (eqNum(N_2,2)) text("AND",N_10,40,LHS_COLOR,0)
		} else text("",N_10,4,LHS_COLOR,40)
	}

label(2) .. SUBROUTINE: put test msg into B_4 for test in N_0
	clearBuf(B_4)
	switch (N_0) {
	case(1)  { insertRgn(B_4,eFile,"blank line",all) }
	case(2)	{ insertRgn(B_4,eFile,"indent = X",all) }
	case(3)	{ insertRgn(B_4,eFile,"indent < X",all) }
	case(4)	{ insertRgn(B_4,eFile,"indent > X",all) }
	case(5)	{ insertRgn(B_4,eFile,"line-length = X",all) }
	case(6)	{ insertRgn(B_4,eFile,"line-length < X",all) }
	case(7)	{ insertRgn(B_4,eFile,"line-length > X",all) }
	case(8)	{ insertRgn(B_4,eFile,"1-4 char string X in line",all) }
	case(9)	{ insertRgn(B_4,eFile,"1-4 char string X at SOL",all) }
	case(10)  { insertRgn(B_4,eFile,"1-4 char string X is at EOL",all) }
	case(11)  { insertRgn(B_4,eFile,"char in range X in line",all) }
	case(12)  { insertRgn(B_4,eFile,"char in range X at SOL",all) }
	case(13)  { insertRgn(B_4,eFile,"char in range X at EOL",all) }
	case(14)  { insertRgn(B_4,eFile,"bounded rgn in line",all) }
	case(15)  { insertRgn(B_4,eFile,"bounded rgn in multi-lines",all) }
	}
>

Fold current file
<rAmiga-\:
	getFileName(B_4,curFile)
	insertRgn(B_4,eFile,".fold",all)
	if (fold("",curFile,all)) {
		setFileName(curFile,B_4)
		downFlag(curFile,changed)
	}
>

Set colors
<alt-help:
	inputKey(N_5)
	while (nothing) {
		gosub label(0)
		putMsg("# of color (0-15) to change (ESC=quit):")
		if (!inputNum(N_5)) {
			refreshDisplay
			putMsg("")
			return
		}
		if (geNum(N_5,0) & geNum(15,N_5)) {
			putMsg("Fg color value (0-3)?")
			inputNum(N_7)
			if (geNum(N_7,0) & geNum(3,N_7)) {
				putMsg("Bg color value (0-3)?")
				inputNum(N_6)
				if (geNum(N_6,0) & geNum(3,N_6)) {
					if (eqNum(N_6,N_7)) {
						putMsg("Fg == Bg is NOT ALLOWED")
						delay(10)
					} else {
						setColors(curFile,N_5,N_7,N_6)
						setColors(" ",N_5,N_7,N_6)   .. so new buf's inherit these
					}
					if (eqNum(N_5,8)) {
						toggle(toTiny)
						toggle(toTiny)
					}
					if (eqNum(N_5,10)) runKey(startup)
					updateDisplay
				}
			}
		}
	}

label(0)  ..subroutine to demonstrate current color settings
	equateNum(N_3,1)
	equateNum(N_5,0)
	do (N_4,2,21) {
		text("",N_4,18,N_3,41)
		if (gtNum(N_4,3) & gtNum(21,N_4) & !eqNum(N_4,12)) {
			if (gtNum(N_5,9)) text(N_5,N_4,19,N_3,0)
			else text(N_5,N_4,20,N_3,0)
			text("< >  < >",N_4,49,N_3,0)
			incNum(N_5)
		}
	}
	equateNum(N_0,0)
	do (N_4,4,20) {
		if (!eqNum(N_4,12)) {
			getColors(curFile,N_0,N_1,N_2)
			text(N_1,N_4,50,N_3,0)
			text(N_2,N_4,55,N_3,0)
			incNum(N_0)
		}
	}
	text("#       ((( For Files )))     Fg   Bg",3,20,N_3,0)
	text("normal text",  4,23,0,0)
	text("cursor",  5,23,1,0)
	text("hilite",  6,23,2,0)
	text("cursor + hilite",  7,23,3,0)
	text("invert",  8,23,4,0)
	text("invert+cursor",  9,23,5,0)
	text("hilite+invert",  10,23,6,0)
	text("cursor+hilite+invert",  11,23,7,0)
	text("        ((( For Screen )))",12,20,N_3,0)
	text("title bar",  13,23,8,0)
	text("msg line",  14,23,9,0)
	text("menus",  15,23,10,0)
	text("tab ruler",  16,23,11,0)
	text("requester",  17,23,12,0)
	text("formfeed",  18,23,13,0)
	text("spare1",  19,23,14,0)
	text("spare2",  20,23,15,0)
>

Set screen dimensions
<lAmiga-f2:
	push(NSTACK_99,sWidth)
	push(NSTACK_99,sHeight)
	putMsg("Enter new screen width <640>:")
	inputNum(N_4)
	if (eqNum(N_4,0)) equateNum(N_4,640)
	if (gtNum(N_4,1024)) equateNum(N_4,1024)
	else
	if (gtNum(400,N_4)) equateNum(N_4,400)
	putMsg("Enter new screen height <200> (if INTERLACE 200 X 2=400 is automatic):")
	inputNum(N_3)
	if (eqNum(N_3,0)) equateNum(N_3,200)
	if (gtNum(N_3,1024)) equateNum(3,1024)
	else
	if (gtNum(50,N_3)) equateNum(N_3,50)
	equateNum(sWidth,N_4)
	equateNum(sHeight,N_3)
	toggle(toTiny) toggle(toTiny)
	if (askYesNo("Restore original dimensions?")) {
		pop(NSTACK_99,sHeight)
		pop(NSTACK_99,sWidth)
		toggle(toTiny) toggle(toTiny)
	} else {
		pop(NSTACK_99,N_4)
		pop(NSTACK_99,N_4)
	}
>

RGB color set 1
<lamiga-esc:
	setRGB(0x005a,0x0fff,0x0f90,0x009f)
>
RGB color set 2
<ramiga-esc:
	setRGB(0x005a,0x0fff,0x0fa0,0x0a55)
>
RGB color set 3
<virtual-esc:
	setRGB(0x0bb0,0x0000,0x0fff,0x0f80)
>

Change the RGB color register values
<alt-esc:
	define(Reg0 ,N_10)    ..NOTE: register n-vars must be contiguous (N_10-N_13)
	define(Reg1 ,N_11)
	define(Reg2 ,N_12)
	define(Reg3 ,N_13)
	define(KReg0 ,N_14)
	define(KReg1 ,N_15)
	define(KReg2 ,N_16)
	define(KReg3 ,N_17)

	define(REGISTER ,N_6)
	define(CURCOLOR ,N_7)

	define(REG_NUM ,N_0)

	define(OFFSET ,N_1)
	define(ROW ,N_2)

	define(RGB_RED ,N_3)
	define(RGB_GREEN ,N_4)
	define(RGB_BLUE ,N_5)

	define(COLOR_1 ,2)
	define(COLOR_2 ,1)

	define(XN_10 ,N_8)
	define(XN_11 ,N_9)

	define(TUNE_COLOR,label(0))
	define(COLORMSG ,label(1))
	define(FINISHED ,label(2))

	push(NSTACK_99,Reg0)  push(NSTACK_99,Reg1)  push(NSTACK_99,Reg2)  push(NSTACK_99,Reg3)
	push(NSTACK_99,KReg0) push(NSTACK_99,KReg1) push(NSTACK_99,KReg2) push(NSTACK_99,KReg3)
	push(NSTACK_99,REGISTER) push(NSTACK_99,CURCOLOR)

	getRGB(Reg0,Reg1,Reg2,Reg3)
	getRGB(KReg0,KReg1,KReg2,KReg3)

	do (ROW,1,15) text("",ROW,15,COLOR_1,49)
	text(">>>> Tune RBG Color Registers <<<<",2,23,COLOR_2,0)

	text("R:",5,18,COLOR_1,0)
	text("G:",6,18,COLOR_1,0)
	text("B:",7,18,COLOR_1,0)

	text("Test Test ",9,20,1,0)
	text("Test Test ",9,-1,2,0)
	text("Test Test ",9,-1,3,0)
	text("Test Test ",9,-1,4,0)
	text("      ARROW keys: new selection",11,20,COLOR_1,0)
	text("SHIFT ARROW keys: inc/dec color value",12,20,COLOR_1,0)
	text("     ESC/Q/CLICK: use new colors",13,20,COLOR_1,0)
	text("   any other key: restore old colors",14,20,COLOR_1,0)

	equateNum(REGISTER,0)
	equateNum(CURCOLOR,0)
	while (nothing) {
		GOSUB COLORMSG
		getKey(XN_10)
		switch (XN_10) {
			case(normal-buttonDown)
			case(normal-esc)
			case(normal-q) { GOTO FINISHED }
			case(normal-upArrow)
				{ decNum(CURCOLOR)
				  if (gtNum(0,CURCOLOR)) equateNum(CURCOLOR,2) }
			case(normal-downArrow)
				{ incNum(CURCOLOR)
				  if (gtNum(CURCOLOR,2)) equateNum(CURCOLOR,0) }
			case(normal-leftArrow)
				{ decNum(REGISTER)
				  if (gtNum(0,REGISTER)) equateNum(REGISTER,3) }
			case(normal-rightArrow)
				{ incNum(REGISTER)
				  if (gtNum(REGISTER,3)) equateNum(REGISTER,0) }

			case(shft-upArrow)
				{ equateNum(XN_11,1) GOSUB TUNE_COLOR }
			case(shft-downArrow)
				{ equateNum(XN_11,-1) GOSUB TUNE_COLOR }
			case(shft-leftArrow)
				{ equateNum(XN_11,-1) GOSUB TUNE_COLOR }
			case(shft-rightArrow)
				{ equateNum(XN_11,1) GOSUB TUNE_COLOR }
			default 	   { setRGB(KReg0,KReg1,KReg2,KReg3)
									  GOTO FINISHED }
		}
		while (inputKey(XN_10)) nothing
	}
FINISHED
	pop(NSTACK_99,CURCOLOR) pop(NSTACK_99,REGISTER)
	pop(NSTACK_99,KReg3) pop(NSTACK_99,KReg2) pop(NSTACK_99,KReg1) pop(NSTACK_99,KReg0)
	pop(NSTACK_99,Reg3)  pop(NSTACK_99,Reg2)  pop(NSTACK_99,Reg1)  pop(NSTACK_99,Reg0)
	putMsg(" ") putMsg("")
	fullRefresh
	return


TUNE_COLOR ..SUBROUTINE to inc/dec a register color value

	equateNum(XN_10,n[REGISTER])
	and(RGB_BLUE,XN_10,15) div(XN_10,XN_10,16)
	and(RGB_GREEN,XN_10,15) div(XN_10,XN_10,16)
	and(RGB_RED,XN_10,15)

	switch(CURCOLOR) {
		case(0) { equateNum(XN_10,RGB_RED) }
		case(1) { equateNum(XN_10,RGB_GREEN) }
		case(2) { equateNum(XN_10,RGB_BLUE) }
	}
	add(XN_10,XN_10,XN_11)
	if (gtNum(XN_10,15)) equateNum(XN_10,0)
	else if (gtNum(0,XN_10)) equateNum(XN_10,15)

	switch(CURCOLOR) {
		case(0) { equateNum(RGB_RED,XN_10) }
		case(1) { equateNum(RGB_GREEN,XN_10) }
		case(2) { equateNum(RGB_BLUE,XN_10) }
	}

	equateNum(XN_10,RGB_RED)
	mul(XN_10,XN_10,16)
	or(XN_10,XN_10,RGB_GREEN)
	mul(XN_10,XN_10,16)
	or(XN_10,XN_10,RGB_BLUE)

	equateNum(n[REGISTER],XN_10)
	return


COLORMSG	..SUBROUTINE to setRGB & display RGB color register contents
	setRGB(Reg0,Reg1,Reg2,Reg3)


	do (REG_NUM,0,3) {
		equateNum(ROW,4)
		mul(OFFSET,REG_NUM,10)
		add(OFFSET,OFFSET,22)

		text("Reg ",ROW,OFFSET,COLOR_1,0)
		text(REG_NUM,ROW,-1,COLOR_1,0)
		text(":",ROW,-1,COLOR_1,0)
		incNum(ROW)

		equateNum(XN_10,n[REG_NUM])
		and(RGB_BLUE,XN_10,15) div(XN_10,XN_10,16)
		and(RGB_GREEN,XN_10,15) div(XN_10,XN_10,16)
		and(RGB_RED,XN_10,15)

		equateNum(XN_10,COLOR_1)
		if (eqNum(CURCOLOR,0) & eqNum(REG_NUM,REGISTER)) equateNum(XN_10,COLOR_2)
		text("  ",ROW,OFFSET,COLOR_1,0)
		text(RGB_RED,ROW,OFFSET,XN_10,0)
		incNum(ROW)
		equateNum(XN_10,COLOR_1)
		if (eqNum(CURCOLOR,1) & eqNum(REG_NUM,REGISTER)) equateNum(XN_10,COLOR_2)
		text("  ",ROW,OFFSET,COLOR_1,0)
		text(RGB_GREEN,ROW,OFFSET,XN_10,0)
		incNum(ROW)
		equateNum(XN_10,COLOR_1)
		if (eqNum(CURCOLOR,2) & eqNum(REG_NUM,REGISTER)) equateNum(XN_10,COLOR_2)
		text("  ",ROW,OFFSET,COLOR_1,0)
		text(RGB_BLUE,ROW,OFFSET,XN_10,0)
		incNum(ROW)
	}
>

Place cursor or scroll if button held; hilite with double click
<normal-buttonDown: 				   .. This cmd was created by  Ken Perano
	..putmsg(clicktime)
	if (eqLoc(curFile,atCursor,mouseLoc) & geNum(40,clickTime) ) {
									  .. (0.40 sec) double-clicked, so hilite
		equateLoc(curFile,locA,mouseLoc)  .. save cur cursor location in locA
		getSplitLines(N_2,N_3)  			 .. determine row range of window
		getFont(B_4,N_1,N_4)					  .. N_4 = character height
		add(N_2,N_2,2)  									.. top row number
		add(N_3,N_3,2)  								 .. bottom row number
		mul(N_2,N_2,N_4)							.. N_2 = top pixel number
		mul(N_3,N_3,N_4)						 .. N_3 = bottom pixel number

		if (not mouseDown) return
		while (not inputWaiting) {
			trackMouse
			if (gtLoc(curFile,locA,mouseLoc)) {   .. update Hilite definition
				equateLoc(curFile,sHilite,mouseLoc)
				equateLoc(curFile,eHilite,locA)
			} else {
				equateLoc(curFile,eHilite,mouseLoc)
				equateLoc(curFile,sHilite,locA)
			}
			mouseXY(N_4,N_0)	 .. scroll only if mouse is in scroll regions
			if (geNum(N_0,N_3)) {				 .. mouse at bottom of screen
				vscroll(2)  					   .. speed up this direction
				updateDisplay
			} else if (geNum(N_2,N_0)) {			.. mouse at top of screen
				vscroll(-1)
				updateDisplay
			} else  										 .. do not scroll
			refreshDisplay
		}
		equateLoc(curFile,atCursor,sHilite) 	   .. cleanup work on mouseup
		refreshDisplay
		.. runKey(normal-kpDot) 				.. auto-copy Hilite to buffer
	} else {									.. standard scrolling feature
		moveCursor(curFile,mouseLoc)
		updateDisplay
		mouseXY(N_1,N_2)
		if (not mouseDown) return
		while (not inputWaiting) {
			trackMouse
			mouseXY(N_3,N_4)
			sub(N_4,N_4,N_2)
			div(N_4,N_4,5)  	 ..  could increase 5 to decrease sensitivity
			vscroll(N_4)							..  multi-speed scrolling
			updateDisplay
		}
	}
>

Set start of hilite region
<shft-buttonDown:
	if (getFlag(curFile,columnar)) {
		runKey(shftAltCtl-buttonDown)
		equateLoc(curFile,sHilite,atCursor)
	} else equateLoc(curFile,sHilite,mouseLoc)
	refreshDisplay >

Set end of hilite region
<alt-buttonDown:
	if (getFlag(curFile,columnar)) {
		runKey(shftAltCtl-buttonDown)
		equateLoc(curFile,eHilite,atCursor)
	} else equateLoc(curFile,eHilite,mouseLoc)
	refreshDisplay >

Set start of invert region
<shftCtl-buttonDown:
	if (getFlag(curFile,columnar)) {
		runKey(shftAltCtl-buttonDown)
		equateLoc(curFile,sInvert,atCursor)
	} else equateLoc(curFile,sInvert,mouseLoc)
	refreshDisplay >

Set end of invert region
<altCtl-buttonDown:
	if (getFlag(curFile,columnar)) {
		runKey(shftAltCtl-buttonDown)
		equateLoc(curFile,eInvert,atCursor)
	} else equateLoc(curFile,eInvert,mouseLoc)
	refreshDisplay >

Place cursor - pad line with spaces to extend it if necessary
<shftAltCtl-buttonDown:
	equateLoc(curFile,locA,atCursor)
	equateLoc(curFile,atCursor,mouseLoc)
	equateNum(N_4,0)
	if (!is(curFile,eLine)) equateNum(N_4,1)
	if (eqNum(N_4,1)) returnFalse
	equateLoc(curFile,atCursor,locA)

	mouseXY(N_1,N_2)
	getFont(B_4,N_11,N_0)
	div(N_1,N_1,N_11)
	moveCursor(curFile,mouseLoc)
	while (is(curFile,space)) clearChar(curFile)
	locToCol(curFile,N_3,atCursor)
	decNum(N_3)
	if (gtNum(N_1,N_3)) {
		sub(N_1,N_1,N_3)
		if (eqNum(N_1,1)) goto label(2)
		while (decNum(N_1)) insertChar(curFile," ")
	} else {
		label(2)
		while (is(curFile,space)) clearChar(curFile)
		while (nothing) {
			moveCursor(curFile,sChar)
			if (!is(CurFile,space)) { moveCursor(curFile,eChar) goto label(1) }
			clearChar(curFile)
		}
		label(1)
	}
	updateDisplay
	>

Find & process filenames with *? wildcards, loading all files that match
<shftAltCtl-z:
	getSearch(B_4)  			 .. save current search string & searchCaps
	push(BSTACK_99,B_4)
	push(NSTACK_99,searchCaps)
	equateNum(searchCaps,0)

	getMaxFiles(N_3)										  .. get maxfiles
	decNum(N_3)
	equateNum(N_11,-1)
	equateNum(N_0,0)			  .. count files loaded and pushed onto stack

	if (!thiskey) { 							  .. being run by startup cmd
		do (N_4,0,N_3) {
			if (getFileName(B_4,buf[N_4])) {
				moveCursor(B_4,sFile)
				while ( !is(B_4,"*")
							& !is(B_4,"?")
								& moveCursor(B_4,eChar)) nothing
				if (!is(B_4,eFile) & isEmpty(buf[N_4])) {
					equateNum(N_11,N_4) 			.. so won't free buf below
					gosub label(50) 				   .. load wildcard files
				}
			}
			clearBuf(B_4)
		}
	} else {
		putMsg("Enter filename-wildcard*? mask to use in loading files")
		freebuf(B_4)
		if (inputString(B_4) & not isEmpty(B_4)) {
			moveCursor(B_4,sFile)
			while (!is(B_4,"*")
				& !is(B_4,"?")
					& moveCursor(B_4,eChar)) nothing
			if (!is(B_4,eFile)) gosub label(50) .. load wildcard files
		}
	}

	.. now load the files
	equateNum(N_1,0)
	while (gtNum(N_0,0) & geNum(N_3,N_1)) {
		if (isEmpty(buf[N_1]) | eqNum(N_11,N_1)) {
			pop(BSTACK_99,buf[N_1])
			decNum(N_0)
			if (eqNum(N_1,N_11)) equateNum(N_11,-1)
			gosub label(49) 	.. free buffer with * or ? in title if exists
		}
		incNum(N_1)
	}
	.. see if had enough file slots
	if (gtNum(N_0,0)) {
		putMsg("Exceeded MaxFiles, so not all were loaded")
		while (gtNum(N_0,0)) { pop(BSTACK_99,B_4) decNum(N_0) }
	}

	gosub label(49)
	pop(NSTACK_99,searchCaps)		 .. restore searchCaps & original search string
	pop(BSTACK_99,B_4)
	setSearch(B_4)
	freeBuf(B_4)
	freeBuf(B_3)
	freeBuf(B_2)
	freeBuf(B_0)
	return

label(49) ..SUBROUTINE to free buf[N_11] if need to
	if (geNum(N_11,0)) freeBuf(buf[N_11])
	equateNum(N_11,-1)
	return

label(50) ..SUBROUTINE: Process filename with wildcards in B_4, loading files
		  .. look for * and replace with #? for Dir
	moveCursor(B_4,sFile)

label(0)
	if (is(B_4,"*")) {
		clearChar(B_4)
		insertChar(B_4,"#")
		insertChar(B_4,"?")
		goto label(0)
	}
	if (moveCursor(B_4,eChar)) goto label(0)

	.. capture dirname, if any - will later prepend to all filenames
	moveCursor(B_4,sFile)
	equateLoc(B_4,locA,atCursor)
	equateLoc(B_4,locB,atCursor)
label(1)
	if (is(B_4,":") | is(B_4,"/")) equateLoc(B_4,locB,atCursor)
	if (moveCursor(B_4,eChar)) goto label(1)

	equateNum(N_2,0)
	freeBuf(B_0)
	if (not eqLoc(B_4,locB,locA)) {
		moveCursor(B_4,locB)
		moveCursor(B_4,eChar)							 .. jump the : or /
		equateLoc(B_4,locB,atCursor)
		equateLoc(B_4,locA,sFile)
		insertRgn(B_0,eFile,B_4,loc)				  .. capture dir name
		incNum(N_2) 						 .. indicates there was a dirname
	}

	insertRgn(B_4,sfile,"List ",all)
	clearBuf(B_3)
	execute(B_3,B_4)			   .. run CLI List program, get filenames

	.. delete first and maybe last line, these aren't filenames
	if (gtNum(N_2,0)) { 							   .. there was a dirname
		movecursor(B_3,sFile)		   .. delete first line if need to here
		clearRgn(B_3,line)
		clearChar(B_3)
	}
	moveCursor(B_3,eFile)
	moveCursor(B_3,sLine)
	clearRgn(B_3,line)
	clearChar(B_3)
	if (isEmpty(B_3)) returnFalse

	.. delete all lines corresponding to Dir names
	moveCursor(B_3,sFile)
	setSearch(" Dir ")
	while (search(B_3,locA,locB,1)) {
		moveCursor(B_3,sLine)
		clearRgn(B_3,line)
		clearChar(B_3)
	}
	if (isEmpty(B_3)) returnFalse

	sortLines(B_3,0)

	.. capture filenames, prepend dirname, load files
	moveCursor(B_3,eFile)
	setSearch("   ")
	while (moveCursor(B_3,sLine) & search(B_3,locA,locB,1)) {
		clearRgn(B_3,line)  						.. clear to end of line
		moveCursor(B_3,sLine)							 ..capture filename
		freeBuf(B_2)
		insertRgn(B_2,eFile,B_0,all)				   .. prepend dirname
		insertRgn(B_2,eFile,B_3,line)
		clearRgn(B_3,line)
		if (geNum(N_3,N_0) & loadFile(B_2)) {
			equateNum(N_5,0)					 .. don't keep non-text files
			equateNum(N_6,0)
			while (gtNum(100,N_6)) {
				copyChar(curFile,N_7)
				if ((geNum(N_7,32) & geNum(126,N_7))
				  | (geNum(N_7,10) & geNum(13,N_7))) incNum(N_5)
				if (!moveCursor(curFile,eChar)) equateNum(N_6,100)
				incNum(N_6)
			}
			movecursor(curfile,sfile)
			mul(N_5,N_5,100)
			div(N_5,N_5,N_6)
			if (gtNum(75,N_5)) freebuf(curFile)
			else if (push(BSTACK_99,curFile)) incNum(N_0)
		}
	}
>

Restore current file to original
<shftCtl-f1:
	if (!askYesNo("Load this file from disk?")) returnFalse
	if (getFileName(FILE_NAME,curFile)) {
		if (getFlag(curFile,readonly)) {
			..putMsg("File is marked READONLY")
			if (thisKey & !askYesNo("Can I turn off the READONLY flag & load file?"))
				returnFalse
			downFlag(curFile,readOnly)
		}
		locToIndex(curfile,N_0,sPage)
		locToIndex(curfile,N_1,atcursor)
		locToIndex(curfile,N_2,shilite)
		locToIndex(curfile,N_3,ehilite)
		locToIndex(curfile,N_4,sInvert)
		push(NSTACK_99,N_4)
		locToIndex(curfile,N_4,eInvert)
		push(NSTACK_99,N_4)
		clearRgn(curFile,all)
		fileSize(curFile,N_4)
		insertFile(curFile,eFile,FILE_NAME)
		downFlag(curFile,changed)
		indextoloc(curFile,sPage,N_0)
		indextoloc(curFile,atcursor,N_1)
		indextoloc(curFile,shilite,N_2)
		indextoloc(curFile,ehilite,N_3)
		pop(NSTACK_99,N_4)
		indextoloc(curFile,einvert,N_4)
		pop(NSTACK_99,N_4)
		indextoloc(curFile,sinvert,N_4)
		refreshDisplay
	}
>

Toggle a global flag or mode setting Off/On
<ctl-g:
	define(mouseX,N_3)
	define(mouseY,N_1)
	define(fontY,N_4)
	define(COLORS,N_2)
	inputKey(N_11)
	updateDisplay
	putMsg(" ") putMsg("")
label(10)
	equateNum(N_11,0)
	getFont(B_4,N_6,fontY)
	equateNum(COLORS,2)
	gosub label(92)
	text(" busies",1,15,COLORS,25)  			text(" columnar",1,40,COLORS,25)
	text(" cram",2,15,COLORS,25)				text(" customScreen",2,40,COLORS,25)
	text(" hideDisplay",3,15,COLORS,25) 		text(" icons",3,40,COLORS,25)
	text(" learnMode",4,15,COLORS,25)			text(" markGadgets",4,40,COLORS,25)
	text(" printTabs",5,15,COLORS,25)			text(" rowCol",5,40,COLORS,25)
	text(" scrollType",6,15,COLORS,25)  		text(" searchCaps",6,40,COLORS,25)
	text(" smartTabs",7,15,COLORS,25)			text(" speakAlerts",7,40,COLORS,25)
	text(" speakMsgs",8,15,COLORS,25)			text(" invisibles",8,40,COLORS,25)
	text(" teachKeys",9,15,COLORS,25)			text(" trapMenus",9,40,COLORS,25)
	text(" useKeys",10,15,COLORS,25)			text(" userGlobalA",10,40,COLORS,25)
	text(" rexxTraffic  (UGB)",11,15,COLORS,25) text(" userGlobalC",11,40,COLORS,25)
	text(" incremSearch (UGD)",12,15,COLORS,25) text(" ",12,40,COLORS,25)

	text(" ",13,15,COLORS,50)
	text("-New Buffers Inherit These-",13,27,4,0)
	text(" autoIndent",14,15,COLORS,25) 		text(" Overstrike",14,40,COLORS,25)
	text(" wordWrap",15,15,COLORS,25)			text(" rightJustify",15,40,COLORS,25)
	text(" autobacKup",16,15,COLORS,25) 		text(" trueTabs",16,40,COLORS,25)
	text(" userlocalA",17,15,COLORS,25) 		text(" Mapchars",17,40,COLORS,25)
	text(" userlocalB",18,15,COLORS,25) 		text(" ",18,40,COLORS,25)

	do (N_1,1,32) gosub label(91) .. get flag status
	while (inputKey(N_1)) nothing
	while (nothing) {
label(0)
		getKeyVal(N_1,N_3)
		if (eqNum(N_3,27) | eqNum(N_3,32) | eqNum(N_3,10)) {
label(1)
			putMsg(" ")
			fullRefresh
			return
		}
		if (mouseDown) {
			mouseXY(mouseX,mouseY)
			if (gtNum(120,mouseX) | gtNum(mouseX,520)) goto label(1)

			inputKey(N_5)	.. collect mouseUp input
			while (mouseDown) { delay(1) inputKey(N_5) }

			decnum(mouseY)
			div(mouseY,mouseY,fontY)
			decNum(mouseY) .. row 1-18

			if (eqNum(mouseY,12) & gtNum(mouseX,320)) goto label(1)
			if (eqNum(mouseY,13)) goto label(1)

			mul(mouseY,mouseY,2)
			decNum(mouseY) .. 1 3 5 7
			if (gtNum(mouseX,320)) incNum(mouseY)

			if (gtNum(mouseY,24)) sub(mouseY,mouseY,3)

			if (gtNum(mouseY,32)) goto label(1)

			gosub label(90) 	.. toggle flag indicated by mouseY==N_1
			if (eqNum(N_11,1)) goto label(10)
			if (eqNum(N_11,2)) return
			gosub label(91) 	.. get new flag status in N_0
		} else goto label(1)
	}
	return

label(90)	..SUBROUTINE to toggle flag status
	switch(N_1) {
	case(1) { if (eqnum(0,busies)) equatenum(busies,1)
								else equatenum(busies,0) }
	case(2) { if (!GETFLAG(curFile,columnar)) UPFLAG(curFile,columnar)
								else DOWNFLAG(curFile,columnar)
			  equateNum(N_11,1) }
	case(3) { if (!GETFLAG(curFile,cram)) UPFLAG(curFile,cram)
								else DOWNFLAG(curFile,cram)
			  equateNum(N_11,1) }
	case(4) { if (eqnum(0,customScreen)) equatenum(customScreen,1)
								else equatenum(customScreen,0) }
	case(5) { if (eqnum(0,hideDisplay)) equatenum(hideDisplay,1)
								else { equatenum(hideDisplay,0) equateNum(N_11,1) }
			}
	case(6) { if (eqnum(0,icons)) equatenum(icons,1)
								else equatenum(icons,0) }
	case(7) { FLIPFLAG(curFile,learnMode)
			  if (getFlag(curFile,learnMode)) {
				equateNum(N_11,2)
				putMsg("LEARN MODE ACTIVE")
			  } else equateNum(N_11,1)
			  fullRefresh
			}
	case(8) { if (!GETFLAG(curFile,markGadgets)) UPFLAG(curFile,markGadgets)
								else DOWNFLAG(curFile,markGadgets)
label(3)
			  gosub label(92) }
	case(9) { if (eqnum(0,printTabs)) equatenum(printTabs,1)
								else equatenum(printTabs,0) }
	case(10) { if (!GETFLAG(curFile,rowCol)) UPFLAG(curFile,rowCol)
								else DOWNFLAG(curFile,rowCol)
                                goto label(3) }
	case(11) { if (eqnum(0,scrollType)) equatenum(scrollType,1)
								else equatenum(scrollType,0) }
	case(12) { if (eqnum(0,searchCaps)) equatenum(searchCaps,1)
								else equatenum(searchCaps,0) }
	case(13) { if (eqnum(0,smartTabs)) equatenum(smartTabs,1)
								else equatenum(smartTabs,0) }
	case(14) { if (eqnum(0,speakAlerts)) equatenum(speakAlerts,1)
								else equatenum(speakAlerts,0) }
	case(15) { if (eqnum(0,speakMsgs)) equatenum(speakMsgs,1)
								else equatenum(speakMsgs,0) }
	case(16) { if (eqnum(0,spooks)) equatenum(spooks,1)
								else equatenum(spooks,0)
			 refreshDisplay
			 equateNum(N_11,1)
			 }
	case(17) { FLIPFLAG(curFile,teachKeys)
				equateNum(N_11,2)
				fullRefresh
				putMsg("TEACHKEYS ACTIVE (Amiga-ESC to terminate)")
			 }
	case(18) { if (eqnum(0,trapMenus)) equatenum(trapMenus,1)
								else equatenum(trapMenus,0) }
	case(19) { if (eqnum(0,useKeys)) equatenum(useKeys,1)
								else equatenum(useKeys,0) }
	case(20) { if (eqnum(0,userGlobalA)) equatenum(userGlobalA,1)
								else equatenum(userGlobalA,0) }
	case(21) { if (eqnum(0,userGlobalB)) equatenum(userGlobalB,1)
								else equatenum(userGlobalB,0)
				swapKey(rexxKey,virtual-t)
			 }
	case(22) { if (eqnum(0,userGlobalC)) equatenum(userGlobalC,1)
								else equatenum(userGlobalC,0) }
	case(23) { if (eqnum(0,userGlobalD)) equatenum(userGlobalD,1)
								else equatenum(userGlobalD,0) }

	case(24) {  if (eqNum(autoIndent,0)) equateNum(autoIndent,1)
				else equateNum(autoIndent,0) }
	case(25) {  if (eqNum(overStrike,0))  equateNum(overStrike,1)
				else equateNum(overStrike,0)  }
	case(26) {  if (eqNum(wordWrap,0))    equateNum(wordWrap,1)
				else equateNum(wordWrap,0) }
	case(27) {  if (eqNum(rightJustify,0)) equateNum(rightJustify,1)
				else equateNum(rightJustify,0) }
	case(28) {  if (eqNum(autoBackup,0))  equateNum(autoBackup,1)
				else equateNum(autoBackup,0)  }
	case(29) {  if (eqNum(trueTabs,0))    equateNum(trueTabs,1)
				else equateNum(trueTabs,0)    }
	case(30) {  if (eqNum(userLocalA,0))  equateNum(userLocalA,1)
				else equateNum(userLocalA,0)  }
	case(31) {  if (eqNum(mapChars,0))  equateNum(mapChars,1)
				else equateNum(mapChars,0) }
	case(32) {  if (eqNum(userLocalB,0))  equateNum(userLocalB,1)
				else equateNum(userLocalB,0)  }
	}
	return

label(91)	..SUBROUTINE to get flag status
	equateNum(N_0,0)
	switch(N_1) {
	case(1) { equateNum(N_0,busies) }
	case(2) { if (GETFLAG(curFile,columnar)) equateNum(N_0,1) }
	case(3) { if (GETFLAG(curFile,cram)) equateNum(N_0,1) }
	case(4) { equateNum(N_0,customScreen) }
	case(5) { equateNum(N_0,hideDisplay) }
	case(6) { equateNum(N_0,icons) }
	case(7) { if (GETFLAG(curFile,learnMode)) equateNum(N_0,1)  }
	case(8) { if (GETFLAG(curFile,markGadgets)) equateNum(N_0,1) }
	case(9) { equateNum(N_0,printTabs) }
	case(10) { if (GETFLAG(curFile,rowCol)) equateNum(N_0,1) }
	case(11) { equateNum(N_0,scrollType) }
	case(12) { equateNum(N_0,searchCaps) }
	case(13) { equateNum(N_0,smartTabs) }
	case(14) { equateNum(N_0,speakAlerts) }
	case(15) { equateNum(N_0,speakMsgs) }
	case(16) { equateNum(N_0,spooks) }
	case(17) { return } 	.. teachKeys MUST be off
	case(18) { equateNum(N_0,trapMenus) }
	case(19) { equateNum(N_0,useKeys) }
	case(20) { equateNum(N_0,userGlobalA) }
	case(21) { equateNum(N_0,userGlobalB) }
	case(22) { equateNum(N_0,userGlobalC) }
	case(23) { equateNum(N_0,userGlobalD) }

	case(24) { equateNum(N_0,autoIndent)  }
	case(25) { equateNum(N_0,overStrike)  }
	case(26) { equateNum(N_0,wordWrap)    }
	case(27) { equateNum(N_0,rightJustify)}
	case(28) { equateNum(N_0,autoBackup)  }
	case(29) { equateNum(N_0,trueTabs)    }
	case(30) { equateNum(N_0,userLocalA)  }
	case(31) { equateNum(N_0,mapChars)    }
	case(32) { equateNum(N_0,userLocalB)  }
	default  { return }
	}

	add(N_8,N_1,1)
	if (gtNum(N_8,24)) add(N_8,N_8,3)
	div(N_9,N_8,2)
	mod(N_18,N_8,2)

	if (eqNum(N_18,0)) equateNum(N_18,36)
	else equateNum(N_18,61)

	if (eqNum(N_0,0))	text("off",N_9,N_18,COLORS,0)
	else				text("ON ",N_9,N_18,COLORS,0)
	return

label(92)	.. SUBROUTINE to put up msg
	text(" GLOBAL FLAGS - CLICK TO TOGGLE ",0,25,4,0)
>

Show description of local flags which are in title bar
<shft-f5:
	updateDisplay
	inputKey(N_4)
	text("                ^^^^^^^^^^^^ Local Buffer Flags in Title Bar",
			0,0,3,-1)
	text("                           ((Capital letter means flag is ON))",
			1,0,3,-1)
	equateNum(N_4,4)
	text("tT = trueTabs     - typing mode: use tab characters, not spaces",2,0,N_4,-1)
	text("iI = autoIndent   - typing mode: auto-indent after line-wrap or return",3,0,N_4,-1)
	text("oO = Overstrike   - typing mode: overstrike mode",4,0,N_4,-1)
	text("kK = autobacKup   - keep backup of original when saving file",5,0,N_4,-1)
	text("rR = Readonly     - file cannot be modified or saved",6,0,N_4,-1)
	text("wW = wordWrap     - typing mode: auto-wrap lines on word break",7,0,N_4,-1)
	text("jJ = rightJustify - typing mode: use right justification",8,0,N_4,-1)
	text("mM = Mapchars     - map illegal chars (ascii 0-3) (See Config! defaults)",9,0,N_4,-1)
	text("cC = Changed      - file has been modified",10,0,N_4,-1)
	text("aA = userlocalA   - used for Save On Idle in std config (Config!M)",11,0,N_4,-1)
	text("bB = userlocalB   - available",12,0,N_4,-1)
	text("fF = Favorite     - favorite file,: lAmiga-q toggles among favorites",13,0,N_4,-1)
	text(" ",14,0,3,-1)
	getKey(N_4)
	fullRefresh
	putMsg(" ")
	putMsg("")
>

Save Uedit state
<rAmiga-f5:
	putMsg("Save state <uestate>:")
	clearBuf(B_4)
	if (!inputString(B_4)) insertRgn(B_4,efile,"uestate",all)
	if (askYesNo("Overwrite existing state file?")) saveState(B_4)
>

Load Uedit state
<rAmiga-f6:
	if (askYesNo("Save changes, if any, before loading state?")) runKey(alt-f2)
	putMsg("Load state <uestate>:")
	clearBuf(B_4)
	if (!inputString(B_4)) insertRgn(B_4,efile,"uestate",all)
	loadState(B_4)

	.. load out of date files if any
	push(NSTACK_99,N_10)
	push(NSTACK_99,N_11)
	push(NSTACK_99,N_12)
	push(NSTACK_99,N_13)
	getMaxFiles(N_11)
	decNum(N_11)
	equateNum(N_12,0)
	equateNum(N_13,curFile)
	do (N_10,0,N_11) {
		if (getFlag(buf[N_10],readOnly)) {
			editBuf(buf[N_10])
			if (eqNum(N_12,0)) {
				if (askYesNo("Load new versions of files?")) equateNum(N_12,1)
				else goto label(0)
			}
			if (eqNum(N_12,1)) runKey(shftCtl-f1)
		}
	}

	label(0)
	editBuf(buf[N_13])
	pop(NSTACK_99,N_13)
	pop(NSTACK_99,N_12)
	pop(NSTACK_99,N_11)
	pop(NSTACK_99,N_10)
>

List files in editor, click name of file to switch to
<ctl-gadget2:
   putmsg(" ")
   text(" ",1,0,1,-1)
   text("  CLICK FILE NAME TO SELECT",2,0,1,-1)
   equateNum(N_13,2)
   equateNum(N_14,0)
   getMaxFiles(N_10)
   do(N_11,1,N_10) {	 ..push [0..max]
	  sub(N_12,N_11,1)
	  freeBuf(B_0)
	  if (getFileName(B_0,buf[N_12])) {
		 incNum(N_13)
		 incNum(N_14)
		 text(" ",N_13,0,1,1) text(N_11,N_13,1,0,2) text("  ",N_13,3,0,0)
		 text(B_0,N_13,5,0,-1)
		 text(" ",N_13,-1,0,-1) text(" ",N_13,79,1,-1)
		 push(N_12,N_12) } }
   incNum(N_13)
   text(" ",N_13,0,1,-1)
   getKey(N_4)
   if (mouseDown) {
	   getfont(B_4,N_3,N_4) 	  .. need fontY
	   freeBuf(B_4)
	   mouseXY(N_15,N_16)
	   div(N_16,N_16,N_4)
	   sub(N_16,N_16,3)
	   do(N_11,1,N_14) {		  ..N_11=[1..N_14]
		  sub(N_17,N_14,N_11)
		  add(N_17,N_17,1)  	  ..N_17=[N_14..1]
		  pop(N_12,N_12)		  ..pop buf# for fileName row [N_14..1]
		  freeBuf(B_0)
		  toWord(B_0,N_17)
		  insertChar(B_0," ")
		  toWord(B_0,N_12)
		  if (eqNum(N_17,N_16)) editBuf(buf[N_12]) }
   }
   fullRefresh
   putmsg(" ")
>

Show current values of line-length, lines/page, tab-table #, colors, etc
<shft-help:
	putMsg("")
	equateLoc(curfile,locA,atCursor)
	moveCursor(curfile,sFile)
	moveCursor(curfile,eLine)
	copyChar(curfile,N_2)
	moveCursor(curfile,locA)
	..updateDisplay
	equateNum(N_1,curFile)
	text(" ",0,0,0,-2)
	text("Serial number:                       Search wildcard :",2,0,0,0)
	text("Buffer       :                       \"\"   multiWild  :",3,0,0,0)
	text("Size         :                       \"\"      allBut  :",4,0,0,0)
	text("Line length  :                       \"\"    eitherOr  :",5,0,0,0)
	text("Lines/page   :                       \"\" singleWhite  :",6,0,0,0)
	text("Tab table    :                       \"\"  multiWhite  :",7,0,0,0)
	text("Left margin  :                       Idle timer      :",8,0,0,0)
	text("Top margin   :                       PM terminator   :",9,0,0,0)
	text("Bottom margin:                       Max files       :",10,0,0,0)
	text("End-of-line  :                       Printer select  :",11,0,0,0)
	text("Color bits   :                       capsLock        :",12,0,0,0)
	text("Split size   :",13,0,0,0)

	text("Values for this buffer",1,0,0,0)
	getSerialNum(N_4)
	text(N_4,2,16,8,0)
	text(N_1,3,16,8,0)  ..buffer number
	getLocal(curFile,N_4,lineLength)
	text(N_4,5,16,8,0)
	getLocal(curFile,N_4,pageLines)
	text(N_4,6,16,8,0)
	getLocal(curFile,N_4,tabTable)
	text(N_4,7,16,8,0)
	getLocal(curFile,N_4,leftMargin)
	text(N_4,8,16,8,0)
	getLocal(curFile,N_4,topMargin)
	text(N_4,9,16,8,0)
	getLocal(curFile,N_4,bottomMargin)
	text(N_4,10,16,8,0)
	text(N_2,11,16,8,0) .. eol, copied it above
	freeBuf(B_3)
	getLocal(curFile,N_10,color)
	toWord(B_3,N_10)
	movecursor(B_3,sfile)
	hexDecimal(B_3)
	text(B_3,12,16,8,0)
	text(splitSize,13,16,8,0)
	freeBuf(B_3)
	insertChar(B_3,wildCard)
	text(B_3,2,56,8,0)
	freeBuf(B_3)
	insertChar(B_3,multiWild)
	text(B_3,3,56,8,0)
	freeBuf(B_3)
	insertChar(B_3,allBut)
	text(B_3,4,56,8,0)
	freeBuf(B_3)
	insertChar(B_3,eitherOr)
	text(B_3,5,56,8,0)
	text(singleWhite,6,56,8,0)
	text(multiWhite,7,56,8,0)
	text(idleTime,8,56,8,0)
	text(pmESC,9,56,8,0)
	getMaxFiles(N_4)
	text(N_4,10,56,8,0)
	text(prefPrint,11,56,8,0)
	if (!eqNum(capsLock,0)) text("YES",12,56,3,0)
	else text("no",12,56,8,0)
	putMsg("Any key to continue")
	fileSize(curFile,N_4)
	text(N_4,4,16,8,0)
	getKey(N_4)
	putMsg("")
	refreshDisplay>

Insert date-time-stamp at cursor
<rAmiga-0:
	clearBuf(B_4)
	clearBuf(B_3)
	insertRgn(B_4,eFile,"date",all)
	execute(B_3,B_4)
	moveCursor(B_3,eFile)
	moveCursor(B_3,sChar)
	clearChar(B_3)
	..insertchar(B_3," ")
	insertRgn(curFile,atCursor,B_3,all)
	>

Save key command of next key pressed to RAM:pData
<rAmiga-8:
	putMsg("Press key to save:")
	if (getKey(N_4)) saveKeys("RAM:pData",N_4,0)
	putMsg("")
>

Restore key command of next key pressed from RAM:pData
<rAmiga-9:
	putMsg("Press key to restore:")
	if (getKey(N_4)) loadKeys("RAM:pData",N_4,0)
	putMsg("")
>

Swap current file with next file
<ramiga-6:
	equateNum(N_4,curFile)
	toggle(curFile)
	swapBuf(buf[N_4],curFile)
>

Compare curFile with buffer 41 from cursor forward (see Ctl-w)
<rAmiga-7:
	compareBuf(curFile,SWAP_BUF)
	swapBuf(curFile,SWAP_BUF)
	swapBuf(curFile,SWAP_BUF)
	swapBuf(curFile,SWAP_BUF)
	swapBuf(curFile,SWAP_BUF)
>

Modify existing search text and then search
<shft-f7:
	define(Get_Next_Input		,label(0))
	define(Process_Input		,label(1))
	define(Take_It_Literally	,label(2))
	define(Take_Literally		,label(3))
	define(Search_And_Continue  ,label(9))
	define(Do_Search			,label(50))
	define(Show_Search_Str  	,label(51))
	define(Search_Success		,N_0)
	define(Was_BackSlash		,N_1)
	define(Fwd_Searching		,N_2)

	if (eqNum(userGlobalD,0)) {
		putMsg("Input search string:")
		inputString(SEARCH_STR)
		setSearch(SEARCH_STR)
		runKey(normal-f9)
		return
	}
	equateLoc(curfile,locA,atcursor)
	equateNum(Search_Success,0) 	.. indicates success of search
	equateNum(Was_BackSlash,0)  	.. indicates last char was a backslash
	equateNum(Fwd_Searching,1)  	.. forward searching
	equateNum(searchCaps,0)
	freeBuf(B_4)
	insertRgn(B_4,eFile,"INPUT SEARCH STRING (pmESC or click to quit):",all)
	GOSUB Show_Search_Str

	while (nothing) {
Get_Next_Input
		getKeyVal(N_4,N_3)
Process_Input
		if (eqNum(N_4,normal-upArrow) | eqNum(N_4,shft-f9)) {
			equateNum(Fwd_Searching,-1)
			GOTO Search_And_Continue
		}
		if (eqNum(N_4,normal-downArrow) | eqNum(N_4,normal-f9)) {
			equateNum(Fwd_Searching,1)
			GOTO Search_And_Continue
		}

		if (eqNum(N_4,normal-buttonUp) | eqNum(N_4,normal-closebox))
			equateNum(N_3,pmESC)
		if (eqNum(N_3,pmESC)) {
			if (eqNum(Was_BackSlash,1)) GOTO Take_It_Literally .. take it
			if (eqNum(Search_Success,0)) {
				putMsg("Search failed")
				equateLoc(curFile,sinvert,einvert)
				moveCursor(curfile,locA)
				updateDisplay
				returnFalse
			}
			putMsg("")
			returnTrue
		}

		switch(N_3) {
			case("\\")   {  if (eqNum(Was_BackSlash,1)) GOTO Take_It_Literally
							equatenum(Was_BackSlash,1)  .. take next char literally
							GOTO Take_Literally
						 }
			case(eitherOr)
			case(allBut) {
							if (eqNum(Was_BackSlash,0)) {
								moveCursor(curfile,locA)
								equateNum(Search_Success,0) .. search failed status
							}
							GOTO Take_It_Literally
						 }
			case(0) 	 { GOTO Get_Next_Input }
			case(8) 	 {  						 .. backspace
							if (eqNum(Was_BackSlash,1)) GOTO Take_It_Literally
							moveCursor(curFile,locA)
							equateNum(Search_Success,0)
							moveCursor(SEARCH_STR,sChar)
							clearChar(SEARCH_STR)
							while (inputWaiting) {
								getKeyVal(N_4,N_3)
								if (!eqNum(N_3,8)) {
									GOSUB Show_Search_Str
									GOSUB Do_Search
									updateDisplay
									GOTO Process_Input
								}
								moveCursor(SEARCH_STR,sChar)
								clearChar(SEARCH_STR)
							}
						 }
			default 	 {
Take_It_Literally										.. whatever it is
							if (eqNum(Was_BackSlash,1)) {
								moveCursor(curFile,locA)
								equateNum(Was_BackSlash,0)  .. reset backslash flag
							}
Take_Literally
							if (geNum(N_3,"A") & geNum("Z",N_3)) {
								equateNum(searchCaps,1)
								moveCursor(curFile,locA)
								equateNum(Search_Success,0)
							}
							insertChar(SEARCH_STR,N_3)
							.. if last search succeeded, back up and rehit
							if (eqNum(Search_Success,1)) {
								if (eqNum(Fwd_Searching,1)) moveCursor(curFile, sChar)
								else {
									moveCursor(curFile, eInvert)
									moveCursor(curFile, eChar)
								}
							}
						 }
		}
		GOSUB Show_Search_Str
Search_And_Continue
		GOSUB Do_Search
		updateDisplay
	}

Do_Search  .. SUBROUTINE to search fwd or bkwd depending on flag
	setSearch(SEARCH_STR)
	if (search(curFile,sInvert,eInvert,Fwd_Searching)) equateNum(Search_Success,1)
	else {
		equateloc(curfile,einvert,sinvert)
		equateNum(Search_Success,0) .. search failed status
		moveCursor(curFile,locA)
	}
	return

Show_Search_Str .. SUBROUTINE to display search string
	freeBuf(B_3)
	insertRgn(B_3,efile,B_4,all)
	insertRgn(B_3,efile,SEARCH_STR,all)
	putMsg(B_3)
>

Use scroll gadget
<normal-middleDown:
	equateNum(N_7,2)		.. color 4 or 7 or whatever
	locToLine(curfile,N_3,efile)		.. get # lines in file
..    getSplitLines(N_0,N_1)
..    sub(N_1,N_1,N_0)
..    sub(N_3,N_3,N_1)

	div(N_3,N_3,400)					.. lines per pixel
	if (geNum(0,N_3)) equateNum(N_3,1)
	incNum(N_3)
	if (not mouseDown) goto label(99)
	putMsg(" ")

	getFont(B_4,N_1,N_2)  .. font x & y
	freebuf(B_4)		  .. don't need this
	add(N_1,N_2,N_2)		.. N_1 = 2 * fontY
	add(N_2,N_2,2)  		.. N_2 = fontY + 2

	decNum(N_1)

	mouseXY(N_4,N_11)
	if (gtNum(N_4,400)) equateNum(N_4,400)
	equateNum(N_0,N_4)

	gosub label(50) 		.. draw gadget button

	goto label(98)
	while (not inputWaiting) {
		trackMouse
		mouseXY(N_4,N_11)
		if (gtNum(N_4,400)) equateNum(N_4,400)
		if (!eqNum(N_0,N_4)) {
			equateNum(N_6,N_4)
			equateNum(N_4,N_0)
			gosub label(50)
			equateNum(N_4,N_6)

			equateNum(N_0,N_4)  	.. redraw gadget button
			gosub label(50)
label(98)
			mul(N_4,N_4,N_3)		.. mul by lines per granule
			if (eqNum(N_4,0)) equateNum(N_4,1)
			lineToLoc(curFile,atCursor,N_4)
			vscroll(atCursor)
			updateDisplay
		}
		if (not mouseDown) goto label(99)
	}
label(99)
	putMsg(" ")
	return

	label(50)		.. SUBROUTINE:  DRAW SCROLL BUTTON FOR SCROLL GADGET
	text("....1....2....3....4....5....6....7....8....9....10",0,0,N_7,0)
	draw(N_4,N_2,N_7,0,0)
	draw(N_4,N_1,N_7,0,1)
	add(N_5,N_4,1)
	draw(N_5,N_2,N_7,0,0)
	draw(N_5,N_1,N_7,0,1)
	incNum(N_5)
	draw(N_5,N_2,N_7,0,0)
	draw(N_5,N_1,N_7,0,1)
>

Apropos - search for specified string in Help-Key (by Tony Sumrall)
<rAmiga-5: .. (ACS change - new command)
		freeBuf(B_3)
		freeBuf(B_0)
		putMsg("Input search string:")
		if (!inputString(B_3) | isEmpty(B_3)) returnFalse
		if(   not insertFile(B_0,eFile,"Help-Key")
			& not insertFile(B_0,eFile,"S:Help-Key")
			& not insertFile(B_0,eFile,"RAM:Help-Key")
			& not insertFile(B_0,eFile,"U:Help-Key") ) {
				putMsg("Can't find Help-Key file")
				returnFalse
		}

		putMsg("Searching...")
		equateLoc(B_0, locA, atCursor)
		getSearch(SEARCH_STR)
		setSearch(B_3)
		while(search(B_0,sInvert,eInvert,1)) {
			moveCursor(B_0, sInvert)
			if(not is(B_0, sLine)) moveCursor(B_0, sLine)
			equateLoc(B_0, locB, atCursor)
			if(not eqLoc(B_0, atCursor, locA)) clearRgn(B_0, loc)
			moveCursor(B_0, locB)
			moveCursor(B_0, downLine)
			if(is(B_0, eFile)) goto label(1)
			equateLoc(B_0, locA, atCursor)
		}
label(1)
		if(not is(B_0, eFile)) {
			equateLoc(B_0, locB, eFile)
			equateLoc(B_0, locA, atCursor)
			clearRgn(B_0, loc)
			..
			if(eqLoc(B_0,sFile,eFile)) {		  .. these few lines are a
				beepDisplay 						.. patch by P. Obminski
				putMsg("Nothing found apropos ")
				text( B_3, 0, 22, 4, 0 )
				while(!inputWaiting) delay(5)  .. .. ..  <-- help yourself!
				returnFalse
			}
			..  									PATCH END
		}

		setSearch(SEARCH_STR)
		equateLoc(B_0, sInvert, eInvert)
		upFlag(B_0, readOnly)
		downFlag(B_0, changed)
		moveCursor(B_0, sFile)
		editBuf(B_0)
		refreshDisplay
		fileSize(B_0,N_4) .. force pack
		putMsg("done")
>

Match braces or parens (by Tom Zartler)
<rAmiga-4:  getSearch(SEARCH_STR)  ..save search string
label(0)
			freeBuf(B_4)
			insertChar(B_4,eitherOr)
			if (is(curFile,"{")) {
				insertRgn(B_4,sFile,"{",all)  ..put braces in B_4
				insertRgn(B_4,eFile,"}",all)
			} else if (is(curFile,"(")) {
				insertRgn(B_4,sFile,"(",all)  ..put parens in B_4
				insertRgn(B_4,eFile,")",all)
			} else {
				insertChar(B_4,"{")
				insertChar(B_4,eitherOr)
				insertChar(B_4,"(")
				setSearch(B_4)
				if (!search(curfile,locA,locB,1)) {
					putMsg("Cursor not set on a left brace or paren.")
					setSearch(SEARCH_STR)
					return
				}
				goto label(0)
			}
			equateLoc(curFile,sInvert,atCursor)
			equateLoc(curFile,eInvert,sInvert)

			setSearch(B_4)
			equateNum(N_4,1)  ..use N_4 as depth counter
			while( not eqNum(N_4,0)) {
			  if ( not search(curFile,locA,locB,1)) {
				setSearch(SEARCH_STR)
				moveCursor(curFile,sInvert) ..put cursor back where we started
				putMsg("No matching brace found.")
				return
			  }
			  if ( is(curFile,123)) incNum(N_4)
			  else if ( is(curFile,40)) incNum(N_4)
			  else decNum(N_4)
			}
			setSearch(SEARCH_STR)  ..restore search string
			moveCursor(curFile,echar)
			if (getFlag(curFile,columnar)) flipFlag(curFile,columnar)
			equateLoc(curFile,eInvert,atCursor)
			refreshDisplay
>


Make an in-use keytable (by Kurt Wessels)
<rAmiga-1:
putMsg("Creating key table, please wait...")
freeBuf(B_0)
insertRgn(B_0,eFile,
"1 !      1
2 @      2
3 #      3
4 $      4
5 %      5
6 ^      6
7 &      7
8 *      8
9 (      9
0 )     10
- _     11
= +     12
\ |     13
UNUSED  14
kp0     15
Q       16
W       17
E       18
R       19
T       20
Y       21
U       22
I       23
O       24
P       25
[ {     26
] }     27
UNUSED  28
kp1     29
kp2     30
kp3     31
A       32
S       33
D       34
F       35
G       36
H       37
J       38
K       39
L       40
; :     41
' \"\"    42
UNUSED  43
UNUSED  44
kp4     45
kp5     46
kp6     47
UNUSED  48
Z       49
X       50
C       51
V       52
B       53
N       54
M       55
, <     56
. >     57
/ ?     58
UNUSED  59
kp.     60
kp7     61
kp8     62
kp9     63
Space   64
BS      65
Tab     66
kpEnter 67
Return  68
ESC     69
DEL     70
menuDown71
menuUp  72
middleDn73
kpMinus 74
middleUp75
upArrow 76
dnArrow 77
rtArrow 78
lftArrow79
F1      80
F2      81
F3      82
F4      83
F5      84
F6      85
F7      86
F8      87
F9      88
F10     89
kpLParen90
kpRParen91
kpSlash 92
kpStar  93
kpPlus  94
Help    95
buttonDn96
buttonUp97
Gadget1-98
Gadget2-99
Gadg3--100
Gadg4--101
CloseBx102
` ~    103
UNUSED 104
",all)
	editBuf(B_0)
	equateNum(N_0,0)  .. outer loop prefix counter
	do (N_0,0,10) {
		moveCursor(B_0,sFile) vScroll(sFile) refreshDisplay
		do(N_8,1,104) {  .. inner loop key counter
			mul(N_7,N_0,104)  .. prefix,
			add(N_7,N_7,N_8)  .. plus key, gives value
			moveCursor(B_0,eLine)
			insertChar(B_0," ")
			if (inUse(N_7)) insertChar(B_0,"X") else insertChar(B_0,"-")
			insertRgn(B_0,atCursor,"   ",all)
	   }
	}
	..equateLoc(B_0,eHilite,sFile)
	insertRgn(B_0,sFile,"

			 Master keytable for current status of Uedit

	X Key in use	 - Key not in use	  UNUSED unassigned keycode

		  Any specific key value is: (prefix * 104) + KeyCode

KeyName    Norm Shft Alt  SA   Ctl  SC   AC   SAC  lAmi rAmi Virtual
|  KeyCode |0	|1   |2   |3   |4	|5   |6   |7   |8	|9   |10	{-- Prefix
|		 | |	|	 |    |    |	|	 |    |    |	|	 |

",all)
	..equateLoc(curFile,sHilite,sFile)
	vscroll(sFile)
	downFlag(curFile,changed)
	refreshDisplay
	putMsg("")
>

See number of buffers and bytes on stacks, change stacking flags
<rAmiga-2:
	define(B_COLORS,1)
	define(H_COLORS,1)
	define(O_COLORS,4)
label(0)
	text("Name       Buf#   Bufs on Stack      Total Bytes    STACKING LIMIT",
		1,0,B_COLORS,-1)
	equateNum(N_1,2)
	equateNum(N_8,0)
	equateNum(N_7,0)
	equateNum(N_5,0)
	freeBuf(B_2)
	freeBuf(B_4)
	do (N_0,0,99) {
		equateNum(N_3,N_0)
		equateNum(N_4,N_0)
		getStackSize(N_4,N_3,N_2)
		add(N_7,N_7,N_4)
		freeBuf(B_4)
		switch(N_0) {
		case(37) { insertRgn(B_4,eFile,"Columnar",all) }
		case(45) { insertRgn(B_4,eFile,"Scratch",all) }
		case(46) { insertRgn(B_4,eFile,"Invert",all) }
		case(47) { insertRgn(B_4,eFile,"Hilite",all) }
		case(48) { insertRgn(B_4,eFile,"Replace",all) }
		case(49) { insertRgn(B_4,eFile,"Search",all) }
		case(99) { insertRgn(B_4,eFile,"Push Pop",all) }
		default { goto label(1) }
		}
		text(B_4,N_1,0,B_COLORS,-1)
		text(N_0,N_1,11,B_COLORS,0)
		text(":",N_1,15,B_COLORS,0)

		if (!eqNum(N_4,0)) text(N_4,N_1,18,H_COLORS,0)
..  	  else text(N_4,N_1,18,B_COLORS,0)
		equateNum(N_3,N_4)  .. store the number of buffers

		equateNum(N_11,0)
		freeBuf(B_3)
		if (gtNum(N_4,0)) {
			while (decNum(N_4)) {
				pop(buf[N_0],B_3)
				fileSize(B_3,N_10)
				add(N_11,N_11,N_10)
				push(buf[N_0],B_3)
				rollstack(buf[N_0],1)
			}
		}
		if (!eqNum(N_11,0)) text(N_11,N_1,37,H_COLORS,0)
		add(N_8,N_8,N_11)

		.. compute buffer overhead
		.. N_3=#buffers in stack
		.. N_11=total bytes of text in all bufs in stack

		mul(N_2,N_3,274)	.. header+stack o/h for all bufs on stack

		div(N_4,N_11,244)	 .. calc min # blocks used
		add(N_4,N_4,N_3)	.. add 1 extra for each buffer for right answer
		mul(N_4,N_4,12) 	.. block o/h

		add(N_4,N_4,N_2)
		add(N_5,N_5,N_4)

		if (!eqNum(N_0,99)) {
			text("   ",N_1,52,O_COLORS,0)
			equateNum(N_4,-2)
			stackBuf(buf[N_0],N_4)
			text(N_4,N_1,52,O_COLORS,0)

			sub(N_4,N_1,1)
			freeBuf(B_4)
			insertChar(B_4,"F")
			add(N_4,N_4,48)
			insertChar(B_4,N_4)
			text(B_4,N_1,56,B_COLORS,0)
		}
		incNum(N_1)
label(1)
		nothing
	}

	text(" ",N_1,0,B_COLORS,-1)
	text("--------",N_1,18,B_COLORS,0)
	text("--------",N_1,37,B_COLORS,0)
	text("SEE STACK BUFFERS",N_1,52,O_COLORS,0)
	text("F8",N_1,71,B_COLORS,0)

	incNum(N_1)
	text("TOTALS:",N_1,0,B_COLORS,-1)
	if (!eqNum(N_7,0)) text(N_7,N_1,18,H_COLORS,0)  	  .. total # buffers
	if (!eqNum(N_8,0)) text(N_8,N_1,37,H_COLORS,0)  	  .. total data bytes


	putMsg("Click a STACKING LIMIT or SEE STACK BUFFERS.   Any key to quit.")

	text(" ", 11,0,B_COLORS,-1)

label(98)
	runKey(Eat_MouseUp_Input) .. soak mouseUp

	getKey(N_4)
	equateNum(N_11,53)
	if (!mouseDown) {
		switch(N_4) {
		case(normal-f1) { equateNum(N_3,3) goto label(96) }
		case(normal-f2) { equateNum(N_3,4) goto label(96) }
		case(normal-f3) { equateNum(N_3,5) goto label(96) }
		case(normal-f4) { equateNum(N_3,6) goto label(96) }
		case(normal-f5) { equateNum(N_3,7) goto label(96) }
		case(normal-f6) { equateNum(N_3,8) goto label(96) }
		case(normal-f8) { goto label(95) }
		default { goto label(99) }
		}

	}
	mouseXY(N_11,N_3)		 .. x & y
	runKey(Eat_MouseUp_Input)			  .. soak mouseUp

	getFont(B_4,N_2,N_1)  .. x & y
	freeBuf(B_4)
	div(N_3,N_3,N_1)
	div(N_11,N_11,N_2)

label(96)
	switch(N_3) {
		case (3)  { equateNum(N_0,37) }
		case (4)  { equateNum(N_0,45) }
		case (5)  { equateNum(N_0,46) }
		case (6)  { equateNum(N_0,47) }
		case (7)  { equateNum(N_0,48) }
		case (8)  { equateNum(N_0,49) }
		case (10) { if (gtNum(52,N_11) | gtNum(N_11,72)) goto label(99)
label(95)
					fullRefresh
					runKey(rAmiga-3)
					goto label(0)
				  }
		default   { goto label(99) }
	}

.. check mouse X here, must be in range
	if (gtNum(52,N_11) | gtNum(N_11,57)) goto label(99)

	if (stackBuf(buf[N_0],-2)) stackBuf(buf[N_0],0) 	.. toggle status
	else					   stackBuf(buf[N_0],10)

	decNum(N_3)

	equateNum(N_4,-2)
	stackbuf(buf[N_0],N_4)
	text("   ",N_3,52,O_COLORS,0)
	text(N_4,N_3,52,O_COLORS,0)

	goto label(98)

label(99)
	putMsg("")
	fullRefresh
>

Scan a buffer stack, select current buffer, delete one or all buffers
<rAmiga-3:
	define(COLOR_0,0)
	define(COLOR_1,2)
	define(COLOR_2,4)
	define(COLOR_3,0)
	define(COLOR_4,8)
label(20)
	runKey(Eat_MouseUp_Input)		  .. soak mouseUp
	equateNum(N_10,1)
	freeBuf(B_4)	  .. display buffer names
	insertRgn(B_4,eFile,"ColumnarF1
Scratch F2
Invert  F3
Hilite  F4
Replace F5
Search  F6
PushPop F7
",all)
	updateDisplay
	movecursor(B_4,sFile)
	equateNum(N_11,0)		 .. zero the col variable
	equateNum(N_1,COLOR_2)
	do (N_4,0,6) {
		freebuf(B_3)
		insertRgn(B_3,eFile,B_4,line)
		text(B_3,0,N_11,N_1,10)
		if (eqNum(N_1,COLOR_2)) equateNum(N_1,COLOR_3)
		else equateNum(N_1,COLOR_2)
		add(N_11,N_11,10)	  .. col += 10
		moveCursor(B_4,downLine)
	}
	text("<-- click",0,-1,COLOR_0,-1)
	text("",1,0,COLOR_4,-1)
	runKey(Eat_MouseUp_Input)			  .. soak mouseUp

	getKeyVal(N_4,N_3)  	.. get a mouse input
	putMsg(" ")
	putMsg("")
	switch(N_4) {	 .. make sure input is a msg-line click
		case(normal-gadget1)
		case(normal-gadget2)
		case(normal-gadget3)
		case(normal-gadget4) { mouseXY(N_9,N_4)
							   runKey(Eat_MouseUp_Input)			 .. soak mouseUp
							   getFont(B_4,N_3,N_4)
							   mul(N_3,N_3,10)
							   div(N_9,N_9,N_3)
							 }
		case(normal-f1) 	 { equateNum(N_9,0) }
		case(normal-f2) 	 { equateNum(N_9,1) }
		case(normal-f3) 	 { equateNum(N_9,2) }
		case(normal-f4) 	 { equateNum(N_9,3) }
		case(normal-f5) 	 { equateNum(N_9,4) }
		case(normal-f6) 	 { equateNum(N_9,5) }
		case(normal-f7) 	 { equateNum(N_9,6) }
		default { fullRefresh returnFalse }
	}
	freeBuf(B_0)
	insertRgn(B_0,eFile,"CURRENT ",all)
	switch(N_9) {
		case(0) {equateNum(N_9,37) insertRgn(B_0,eFile,"Columnar",all) }
		case(1) {equateNum(N_9,45) insertRgn(B_0,eFile,"Scratch",all) }
		case(2) {equateNum(N_9,46) insertRgn(B_0,eFile,"Invert",all) }
		case(3) {equateNum(N_9,47) insertRgn(B_0,eFile,"Hilite",all) }
		case(4) {equateNum(N_9,48) insertRgn(B_0,eFile,"Replace",all) }
		case(5) {equateNum(N_9,49) insertRgn(B_0,eFile,"Search",all) }
		case(6) {equateNum(N_9,99) insertRgn(B_0,eFile,"PushPop",all) }
		default { fullRefresh returnFalse }
	}
	insertRgn(B_0,eFile," Buffer ",all)
	moveCursor(B_0,eFile)
	toWord(B_0,N_9)

	freeBuf(B_4)
	insertRgn(B_4,eFile,"Roll Stack
Direction
Free Buf
Free Stack
Done
",all)
	movecursor(B_4,sFile)
	equateNum(N_11,0)
	equateNum(N_1,COLOR_2)
	text(" ",0,0,COLOR_0,-1)
	do (N_4,0,4) {
		freebuf(B_3)
		insertRgn(B_3,eFile,B_4,line)
		text(B_3,0,N_11,N_1,10)
		if (eqNum(N_1,COLOR_2)) equateNum(N_1,COLOR_3)
		else equateNum(N_1,COLOR_2)
		add(N_11,N_11,10)
		moveCursor(B_4,downLine)
	}
	equateNum(N_1,1)
	while (nothing) {
		freeBuf(B_1)
		moveCursor(buf[N_9],sFile)
		equateNum(N_4,N_1)
		if (eqNum(N_9,99)) {
			freeBuf(B_4)
			freeBuf(B_0)
			getFileName(B_4,BUF_99)
			if (!isEmpty(B_4)) {
				insertRgn(B_0,eFile,"First Out of Stack 99 = ",all)
				insertRgn(B_0,eFile,B_4,all)
			} else insertChar(B_0," ")
		}
		text(B_0,N_4,0,COLOR_1,-1)
		while (nothing) {
			incNum(N_4)
			freeBuf(B_4)
			if (insertRgn(B_4,eFile,buf[N_9],line)) text(B_4,N_4,0,COLOR_0,-1)
			else  if (is(buf[N_9],eLine)) text(" ",N_4,0,COLOR_0,-1)
			else { text(" ",N_4,0,COLOR_0,-1) goto label(24) }
			if (!is(buf[N_9],eLine)) moveCursor(buf[N_9],eLine)
			if (!moveCursor(buf[N_9],eChar)) goto label(24)
			if (eqNum(N_4,12)) {
				insertRgn(B_1,eFile,"...MORE...  ",all)
				moveCursor(B_1,eFile)
				goto label(24)
			}
		}
label(24)
		incNum(N_4)
		equateNum(N_0,0)
		fileSize(buf[N_9],N_0)
		toWord(B_1,N_0)
		insertRgn(B_1,eFile," byte(s)",all)
		text(B_1,N_4,0,COLOR_1,-1)
		while (geNum(12,N_4)) {
			incNum(N_4)
			text(" ",N_4,0,COLOR_0,-1)
		}
		..
		getKeyVal(N_4,N_3)    .. get a mouse input
		switch(N_4) {	 .. make sure input is a msg-line click
			case(normal-gadget1)
			case(normal-gadget2)
			case(normal-gadget3)
			case(normal-gadget4) {  mouseXY(N_4,N_3)
									getFont(B_4,N_2,N_3)
									mul(N_3,N_3,10)
									div(N_3,N_4,N_3)
								 }
			case(normal-buttonDown) { equateNum(N_3,0) }
			case(normal-bs)
			case(normal-del)		{ equateNum(N_3,2) }
			case(normal-return)
			case(normal-esc)
			default 				{ equateNum(N_3,4) }
		}
		if (eqNum(N_9,49) & !isEmpty(SEARCH_STR)) setSearch(SEARCH_STR)
		if (eqNum(N_9,99) & !isEmpty(BUF_99)) push(BSTACK_99,BUF_99)
		runKey(Eat_MouseUp_Input)			  .. soak mouseUp
		..
		switch(N_3) {
			case(0) { goto label(28) }
			case(1) { if (eqNum(N_10,1)) equateNum(N_10,-1)
					  else equateNum(N_10,1)
					}
..NOTE:  when the stack-buffer flag >0 and you try to FREE a buffer, you
..do NOT free it.  Instead it is put onto the buffer stack.  So in order to
..free the buffer you must set flag=0 temporarily, free the buffer, and then
..set flag>0 again to restore the stack-buffer flag status.  That is what
..the two cases below are doing.

			case(2) { equateNum(N_6,-2)
					  if (stackBuf(buf[N_9],N_6))		.. if saving on stack
						stackBuf(buf[N_9],0)	 .. turn OFF flag temporarily

					  if (eqNum(N_9,99)) pop(BSTACK_99,BUF_99)
					  freeBuf(buf[N_9])
					  stackBuf(buf[N_9],N_6)	 .. restore buf-saving status
label(28)
					  if (!gosub label(50)) {
						fullRefresh
						goto label(20)
					  }
					}
			case(3) { equateNum(N_6,-2)
					  if (stackBuf(buf[N_9],N_6))  .. if saving bufs on stack
						stackBuf(buf[N_9],0) .. turn OFF stacking temporarily

					  stackBuf(buf[N_9],-1) 			   .. clear the stack
					  freeBuf(buf[N_9])

					  stackBuf(buf[N_9],N_6)	 .. restore buf-saving status
					  fullRefresh
					  goto label(20)
					}
			default { fullRefresh
					  goto label(20)
					}
		}
	}
	return

label(50)	..SUBROUTINE:  Swap current buffer with stack & roll stack
	equateNum(N_0,N_9)
	equateNum(N_11,0)
	getStackSize(N_0,N_11,N_3)
	if (eqNum(N_0,0)) {
		putmsg("buffer stack is empty")
		delay(5)
		returnFalse
	}
	if (!isEmpty(buf[N_9])) push(buf[N_9],buf[N_9])
	rollstack(buf[N_9],N_10)
	pop(buf[N_9],buf[N_9])
>

Soak inputs until mouseUp
<624:		.. "Eat_MouseUp_Input"
	push(NSTACK_99,N_4)
	inputKey(N_4)
	while (mouseDown) { delay(1) inputKey(N_4) }
	pop(NSTACK_99,N_4)
>


<defines: >
