home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fish 'n' More 2
/
fishmore-publicdomainlibraryvol.ii1991xetec.iso
/
fish
/
text
/
editors
/
uedit-stuff
/
indent.uek
< prev
next >
Wrap
Text File
|
1991-01-10
|
5KB
|
112 lines
For UEK users who use the commands in the Indent file (documented in
Indent.doc), the following functions will make those commands more
responsive, by preventing them from setting the PAGE_ displayFlag bit when
only the cursor line has been modified. These definitions replace the
functions normal-tab, normal-bs (if you want to use it; it's commented out),
and most importantly virtual-[, which is the engine at the core of the major
indent functions. Also included is a commented-out command (virtual-]) which
is useful for finding out what is happening to displayFlag. It shows which
bits are currently set.
NEEDS TO BACKSPACE SINGLY SOMETIMES?
Un-indent with alt-[ if in leading whitespace, else delete last char
..<normal-bs: if (is(curfile, sline)) {
if (eqloc(curfile, atcursor, spage))
vscroll(atcursor) .. BUG workaround
if (movecursor(curfile, schar))
clearchar(curfile)
return
}
equateloc(curfile, locA, atcursor)
while (movecursor(curfile, schar)) {
if (not is(curfile, whitespace)) { .. we're in mid-line
movecursor(curfile, locA)
getaddress(20, n9) .. displayFlag
peek(n9, n8, 2)
movecursor(curfile, schar)
clearchar(curfile)
poke(n9, n8, 2) .. update this line only!
return
}
if (is(curfile, sline)) { .. we are in the leading indent
runkey(alt-[)
return
}
}
> .. use shift-backspace to simply delete the previous character
UEK version -- refuses to set PAGE_ or ALLPAGE_ in displayFlag if it is run
only once, e.g. by alt-]. Goes ahead and sets them if run by e.g. alt-r.
Indent cursor line to column specified in n54, not preserving cursor col
<virtual-[: getAddress(20, n9) .. displayFlag
peek(n9, n7, 2)
if (not is(curfile, sline)) movecursor(curfile, sline)
getlocal(curfile, n52, leftmargin)
setlocal(curfile, leftmargin, n54)
.... The manual says that nonzero leftmargin causes autoindent
.... to be ignored. But in version 2.5d1 autoindent false causes
.... leftmargin to be ignored! Grrr:
if (not getflag(curfile, autoindent)) {
add(n52, n52, 100000)
flipflag(curfile, autoindent)
}
typechar(eline) .. cause indent to leftmargin (n54)
movecursor(curfile, upline)
clearchar(curfile)
if (genum(n52, 100000)) { .. GRRR
sub(n52, n52, 100000)
flipflag(curfile, autoindent)
}
setlocal(curfile, leftmargin, n52) .. restore old margin
.. SUPER BOGUS BUG WORKAROUND:
if (getflag(curfile, mapchars)) {
flipflag(curfile, mapchars)
typechar(0) .. snaps it back to reality!
flipflag(curfile, mapchars)
} else
typechar(0)
.. end super bogosity
if (eqnum(n7, 0)) { .. false if run more than once
peek(n9, n8, 2) .. new displayFlags value
and(n8, n8, 7) .. mask out bad bits
poke(n9, n8, 2)
}
movecursor(curfile, locA)
if (is(curfile, sline)) runkey(ctl-[)
>
Display the displayFlag bits for optimizing stuff.
..<virtual-]: getAddress(20, n5) .. displayFlag, 2 bytes
peek(n5, n6, 2)
freebuf(buf97)
insertrgn(buf97, sfile, " press any key
The following displayFlag bits are set:", all)
if (and(n4, n6, 1)) insertrgn(buf97, efile, "
SHOWCURSOR_", all)
if (and(n4, n6, 2)) insertrgn(buf97, efile, "
VSCROLL_", all)
if (and(n4, n6, 4)) insertrgn(buf97, efile, "
HSCROLL_", all)
if (and(n4, n6, 8)) insertrgn(buf97, efile, "
SHOWEOS_", all)
if (and(n4, n6, 16)) insertrgn(buf97, efile, "
PAGE_", all)
if (and(n4, n6, 0xffe0)) insertrgn(buf97, efile, "
ALLPAGE_", all)
if (eqnum(n6, 0)) insertrgn(buf97, efile, "
(none)", all)
insertchar(buf97, eline)
equatenum(n3, curfile)
editbuf(buf97)
getkey(n6)
editbuf(buf[n3])
freebuf(buf97)
>
that should use text() now.