Working with Virtual Highlighting Pens

Contents of Article


Colors and color palettes

Colors and LOCATE

Do not confuse virtual highlighting pens with automatic colorization

Avoid confusing yourself with clashing colors

Example of using highlighting pens

Resetting highlighting pen colors back to the default

Highlighting pens and special situations

NOTE lines and highlighting pens


In the "good old days" when people worked with big printouts, it was often necessary to mark them up with highlighting pens.  SPFLite now allows a way to do this to files with "virtual" highlighting pens and with optional highlight requests with FIND and CHANGE commands.

You can mark a section of text as RED, BLUE, GREEN or YELLOW or clear a colored text area, using the keyboard functions (PenRed), (PenBlue), (PenGreen), (PenYellow) and (PenStd).  "STD" refers to the "standard" foreground and backgrounds colors for text.


You can also add the keywords RED, BLUE, GREEN, YELLOW or STD to any FIND or CHANGE command.

Color keywords are much more precisely defined.  Previously, if the name of a color, like RED, appeared on a FIND or CHANGE command, any string that was found would have its color changed, even if the underlying string data itself was not changed.  Now, by using + and - prefixes on color names, you can precisely control the exact effect of using a color.  Using RED as an example:

Don't forget the other things you can do with your "virtual printout" file.  Line labels and line tags are like "paper clips", and NOTE lines can be used to "scribble" on the "printout" like you would with a "sticky note".  See Working with Line Labels, Working with Line Tags, and Working with NOTE Lines for more information.

The colors you set are persistent, may be found with LOCATE color options, and may be cleared with RESET color options.  As with all persistent attributes of a file, the STATE profile option must be ON to enable persistent colors.  If STATE is OFF, you can still put colors on your text, but when you close the file and reopen it, the color information will be discarded.

Colors and color palettes

The exact color palette used for RED, BLUE, GREEN or YELLOW can be tailored in the Screen Options settings, so you can adjust the colors to maximize readability.  So, these colors are actually color categories, which you can adjust to anything you want.  For example, you could change GREEN to actually display orange or purple if you really wanted to.  A more likely choice is to make RED appear orange, if regular red is too dark for you.  Or, you might wish to reverse the foreground and background colors of RED to improve readability.  Some color choices (like Red and Blue) seem to look better as white letters on a colored background, and others (like Green and Yellow) seem to look better as black letters on a colored background.  It's very subjective and a matter of personal taste.

Why these colors?  Experiments suggested that these were the only ones that would look good as highlighting colors for what we had in mind.  You can see this for yourself if you try various colors on real paper with real highlighting pens.  Right now, these appear to be the correct choices, and we didn't want to overly complicate a new feature without some feedback as to how it is meeting your needs.  If you feel strongly that you need additional color categories, we invite your feedback on the SPFLite web site.

Colors and LOCATE

Once your text is colored, you can use LOCATE to find lines having any text with a particular color.  LOCATE allows the use of STD to indicate lines which have only standard coloring on them.  You can also find lines which have any sort of coloring on them at all by saying LOCATE NOT STD.

You can use LOCATE ALL to exclude or unexclude lines based on their 'condition', which includes their color.

See LOCATE - Scroll to a Specific Line for more information.

Do not confuse virtual highlighting pens with automatic colorization

When you edit a file such as program source code, and you have an automatic colorization file defined for that file type, SPFLite renders your data lines according to the syntax and color choices defined in the .AUTO file.

Suppose one of the lines in your .AUTO file defined the keyword FUNCTION to be displayed in red, like this:

       WORD 4 FUNCTION                                -- where 4 means "red" in an .AUTO file

Now, suppose you have a data line with the keyword FUNCTION on it and it is being displayed in red.

Then you say LOCATE RED to find this line.  Will it work?  No.

It turns out that virtual highlighting pens, and automatic colorization of syntax, are two completely different things.  (You may note that in .AUTO files, you can assign any available color you wish by specifying its RGB or BGR value, whereas virtual highlighting pens only have four names: RED, BLUE, GREEN and YELLOW, even though you can adjust the specific colors that appear when you use them.)

At present, there is no way for SPFLite to relate colors defined in an .AUTO file with the colors used by virtual highlighting pens. One has nothing to do with the other.  (This could always change in the future, but this is how it works right now.)

So, the LOCATE RED won't find the line with the red FUNCTION on it - at least not that way.  

If you wished (and were careful not to confuse yourself doing so) you can apply the (Pen*) functions to set a virtual highlighting pen color to text that is already being colorized with an .AUTO file.  The color originating with the virtual highlighting pen will take precedence over the .AUTO colorization.  If you reset the virtual highlighting pen coloring, the .AUTO colorization will resume displaying its colors as usual.

Avoid confusing yourself with clashing colors

The exact colors displayed by the highlighting pens can be adjusted in the Screen Options dialog to anything you wish.  However, if you choose the same colors as SPFLite uses for text selection, for indication of found text during a FIND or CHANGE operation, or the colors displayed as a result of an active Automatic Colorization file (a filetype.AUTO file), it could get very confusing.  

It will probably be best to avoid those particular colors.  If you really need to apply highlighting pens to a file that has HILITE AUTO enabled, you may wish to temporarily issue a HILITE AUTO OFF so that you don't run into a confusing "color clash" situation.  As noted above, you can mix .AUTO colorization and virtual highlighting pens, but you need to be careful not to confuse yourself.

Example of using highlighting pens

It's easy to highlight text.  You will have to establish a mapping for the (Pen*) functions.  Here is a suggested mapping you may find useful.  As always, you are free to map these any way you wish:  

Ctrl-Shift-R = (PenRed)

Ctrl-Shift-B = (PenBlue)

Ctrl-Shift-G = (PenGreen)

Ctrl-Shift-Y = (PenYellow)

Ctrl-Shift-S = (PenStd)

Here is our data file:

We are going to highlight the word SEVENTEEN, since it is obviously out of place here.  By double-clicking on the word, or by using the Shift+arrow keys, highlight (that is,select) the text:

Finally, while this word is highlighted (again, that is, selected), press one of the highlighting-pen keys you mapped above.  

Here, we are going to press the Ctrl-Shift-Y key to make the text yellow:

That's all there is to it.  

If you want to "uncolor" this word, you can select it again, and use the key mapped to (PenStd), which was mapped to Ctrl-Shift-S in our example.  Or, you can use the RESET command, discussed next.

Resetting highlighting pen colors back to the default

RESET can be used to clear highlighting-pen colors from the entire file, or from a given line range.  Multiple color names may appear on RESET.  Each color name you specify reverts back to the standard text color.  So, if you had some text marked up in BLUE, and you want that text returned to the normal display color, you would say RESET BLUE.  

If you want to clear all of the colors back to the default, you can use RESET STD or RESET COLOR, both of which mean the same thing.

Highlighting pens and special situations

If you do a FIND command to find text has been colored with a highlighting pen, the highlighting produced by the HILITE FIND profile option will take precedence.  Once you find some other string, or do a RESET command, the HILITE FIND highlighting will go away, and the color from the highlighting pen will be restored.

This of course assumes you have not specified another color on the actual FIND command itself.   If so, the new color specified on the FIND command takes effect.  Example:  FIND ALL ABCD +GREEN would set all ABCD strings to GREEN.   A subsequent  FIND ALL ABCD +RED would change the coloring of all  ABCD strings from GREEN to RED.

In practice, what this means is that if you use a FIND or CHANGE to locate text that already has a color, or use them to change the color of some text, due to the highlighting action, the last string affected by the command may appear to have the "wrong" color.  To get the "right" color to show up, just press Enter.

A similar situation exists if you overtype or insert data into an area of a data line that has an existing highlighting color.  As you enter the text, it will be displayed in the "standard" text colors.  When you press Enter, the true color(s) of the data will be restored.

Why can't you see the 'correct' colors immediately?  It's basically a timing issue, related to when keyboard data or command-driven data changes occur, vs. when the screen display is refreshed.  It is simply a design limitation, which may or may not be addressed in a future version of SPFLite.

If you use the (Swap) keyboard function to swap text which has been colored with a highlighting pen, the highlighting is not swapped, only the data is.  Again, this is a design limitation, which may or may not be addressed in a future version of SPFLite.

If you swap lines using the M/MM and W/WW line commands, and any of the lines involved have been colored with a highlighting pen, the colors will be retained when the lines are moved to their new positions.

Be aware that space characters in a file are ordinary data, and can have a color associated with them.  This can affect FIND and CHANGE commands and the < and > Data Shifting line commands.  See Shifting Data for more information.

NOTE lines and highlighting pens

At present, you cannot use the the virtual highlighting pen functions to color the text of NOTE or xNOTE lines.

Created with the Personal Edition of HelpNDoc: Free CHM Help documentation generator