The Delimited BandAid macro provides a method for using
color on
delimited columns of text.
Here are some of its characteristics:
- any character can be used as a
delimiter
- column colors are generated by the macro
- colors 'stick' to
their locations, even when scrolling up,
down, left, or right
-
more than one file can have their delimited columns
colored, but the
colors are file-specific in that the
colors and column widths for one
file are not the same as
those of any other file
- the colors of
one file can be deleted without affecting
the colors of another
file
- any individual column color can be change to any other TSE
color
- the Help Screen and the text below provide an exact
procedure for activating the delimited column colors for a
file
Delimited BandAid, Dba.mac, is an extraction from the full
Be BandAid
macro. The full macro also supports tabbed
columns, indented columns, and
margins, as well as drawing
individual color bands of any size anywhere in a
text file
by using marked blocks. It allows saving and loading color
band
definitions, copying the color bands of one file to
another, internal
often-used color bands. The full macro
also has a rich set of
toggle/reset/delete menu that allows
temporary on/off states for individual
color bands or sets.
This macro, Dba.mac, does have two weaknesses, which are the
reasons I
asked the question about bookmarks.
First, if you apply color bands to marked line block areas
of a text
file, the color bands are defined for those AREAS,
not the text they cover.
Thus, if you add or delete lines
above the color band areas, the text changes
location, but
the color bands do not.
Second, with large numbers of color bands defined in a file,
there is a
noticeable slowdown when executing single-column
movement, such as multiple
cursorleft or cursorright or
scrollleft or scrollright movements. The hooked
procedure
that produces the color for the screen has to do a lot with
EACH
occurrence of an action that changes the statusline.
More than 100 color
bands defined in one file will slow
things down. (Note: the speed problem is
not noticed in
other files that have far fewer than 100 color bands. If
one
file has 100 color bands, and another only has 20, the latter
will not
be speed-affected by the one with 100. Each file is
handled independently
from all other files by the macro.)
Neither of these affects what the macro actually does, but
both are
problems I hope to solve using things I learn about
bookmarks.
The first problem is avoided if the whole file is used for
color banding
rather than marked blocks, and the second
problem is avoided by having
something less than 100 color
bands defined for a file.
Anyway, aside from these, Delimited BandAid works well and
is a happy
conclusion for problem-solving on my part.
Enjoy. :)
Here is the Help Screen for
Dba:
=======================================================================
Macro Name: Delimited BandAid
Macro Version: DbaRev1012
Assigned Keys:
<CtrlShift j><j>
execmacro('Dba') // execute macro
<CtrlShift
j><x> mDbaBandAidExit() // terminate
macro
<CtrlShift j><h> quickhelp('DbaHelp;) // help
screen
<CtrlShift j><a>
mDbaMakeDelim() // make the color
bands
<CtrlShift j><c> mDbaChangeColor() //
change a color band's color
<CtrlShift j><d>
mDbaBandsClear() // delete color bands in current
file
<CtrlShift j><k>
mDbaKeyClick() // toggle keyclick
on/off
Procedure:
1. Execute macro
2. Go to delimited
file
3. Optionally mark delimited lines with line
block
(Preferred method: no block-see Notes
below.)
4. Place cursor line on a representative delimited
line
(This is where the macro determines the column
widths.)
5. Press <CtrlShift j><a> to start
activation
6. Answer prompt for single character delimiter
7.
Decide whether to use Normal or Random color set
8. Color bands
display
Notes:
1. If no block is marked, the macro will process the
entire
file. ANY line that has the same number of
delimited columns
as the representative line will be color
banded.
2. If no block is marked or if the last line of a
marked
block is the last line in the file, the color
banding
will ALWAYS extend to the bottom of the
file.
3. If a block is marked that does not include the last
line
of the file, the color banding is tagged to its
original
location, not to the text there. This means that
if lines
are added or deleted above the color banding, the
text
under the color banding will change according to
how
many lines were added or deleted above the
color
banding. (This is a problem being worked
on.)
4. The colors used by the macro automatically are
those
listed in the fcolors DataDef in the source.
'Normal'
coloring uses fcolors colors in order from 1 to
however
many. 'Random' uses a simple randomizing process
to
choose differing colors each time new color banding
is
activated.
5. Individual color band colors can
be changed using the
assigned key above.
6. The
color bands in the current file may be deleted using
the
assigned key above without affecting color bands in
other
files.
7. The Exit assigned key above will remove all color
bands
on all files and deactivate the macro.
8.
Color bands are file-specific. Color bands created for
one
file do not show on other files.
9. Color bands are area-specific, not
text-specific. Color
bands 'stick' to the location where
they are created even
when scrolling up, down, left, or
right. (See #3 above)
10. If you would like to change the colors used by
the
macro, go to the fcolors DataDef and enter the
numeric
decimal (base 10) values for the colors you
prefer. The
sequence for the DataDef table is left to
right, top to
bottom, and this is the sequence used by the
'Normal'
color selection when creating new color bands.
You can
use any color from 0 to 255, and you can enter
them more
than once, such as having alternating two-color
bands.
Also, you can reduce or increase the number of
colors in
this DataDef. Recompile and use.
11. The
cursor line color and marked block colors are
protected
and display properly over the color bands.
12. If the keyclick is bothersome,
use the assigned key
to toggle it off or on.
13. Color
bands may overlap, but only the newest one will
show at
the location of the overlap.
14. If you created color bands for a delimited
file and for
whatever reason decide to do it over, be sure
to delete
the first set of color bands first, then create
the new
set of color bands for the delimited area.
15.
The entire delimited column area does not have to be one
solid color band. You can mark a section with a line
block
and activate its color bands, then mark another
section
with another block and activate it. Any number
of color
band sections can be in one file, or in any
number of
files.(Keep #3 and 9 limitations in mind.)
17. Color bands can be created
over as many files as
desired. Each File's color bands are
entirely separate
from any other file's color
bands.
18. If you want to just 'design' delimited columns on
a
blank file, space a delimiter character across
the
screen, then activate the columns.
17. As long as
the delimiter character remains in its
proper column, it
is not part of the color band. If the
column width is
changed in any line, the color bands
will not adjust but
will remain as they were originally
activated.
18.
Large numbers of color bands in a single file will
cause a
scrolling slowdown for that file, but not for
other files
with fewer color bands. The threshold seems
to be
something over 100 color bands. This slowdown only
occurs
when repetitive single-space movement of the
cursor or
screen. Page up, page down, and using multiple
column
scrolling commands (such as scrollleft(40),
scrollright(40), rollleft(40), and rollright(40). These
and others like them are not affected by large numbers
of
color bands.
19. Any character can be used as a delimiter, but be
sure
that it is a real delimiter. Odd color bands may
result
otherwise. :)
20. If you change a color band
color, the new color will go
all the way to the bottom of
the color band, even if
there are non-color band lines in
the color band column.
Enjoy.