1 VI VI is a text editor written in TPU, for more background information, see "HELP VI Introduction". 2 Introduction VI is an editor which was originally written by Bill Joy at the University of Berkeley in California. It was written to work on the UNIX (UNIX is a trademark of the American Telephone and Telegraph Corporation) operating system, and until now, has not been widely available on other operating systems. VI is an excellent editor, but its full potential can not be realized without a full understanding of the commands that are available. Currently, this help file does not describe all of the keystrokes that are defined. You should consult one of the many VI quick reference guides for that information. This version of VI should be close enough to the real version that the documentation of the additional features here, and a VI quick reference guide should suffice. VI is a mode oriented editor, and has two modes. One mode allows text entry by simply typing (called text entry mode), and the other allows text manipulation by using the typing keys (called command mode). This is a completely different approach to editing than used by most other text editors and word processors. However, it provides some incredible possibilities for speed because one does not have to look to find function keys to perform certain editing tasks. Also, many more commands can be placed within reach of your hands because all of the keys on the keyboard are available for use during command mode operations. 2 Author This emulation of VI was written by Gregg Wonderly Mathematics Department Oklahoma State University Internet: gregg@nemo.math.okstate.edu 2 Extensions This emulation of VI contains some extensions that were made possible by the existance of supporting primitives in TPU. A partial list of these extensions follows. Select regions are available and can be used to perform many operations such as deleting, yanking, changing, shifting, changing/inverting case, compiling TPU procedures, filling regions of text to fit within a specified range of columns and writing portions of buffers to files/devices. Multiple buffers are available as well as multiple windows to display the buffers in. This allows you to edit/view many files at once. You can force the editor to expand tabs as you type them, so that they are replaced by spaces in the text. You can control the use of TPU's typeahead recognition so that you see each screen update action while you type (with ":set [no]update"). The EX mode commands, 'show buffers' and 'show files', display information abou t existing buffers, and the current list of files to edit, respectively. The EX mode command, sh, has an alias called 'dcl', which is a little more indicative of the action taken. The EX mode command, buffer, allows you to create a new buffer that may not have a file associated with it. It also allows you to create a buffer by a specific name, and associate an arbitrary file with that buffer. The EX mode command, messages, allows you to map the TPU message buffer unto th e current window for viewing. The EX mode command, delbuf, allows you to delete a buffer according to its name. The EX mode command, prev, allows you to move back to the previously edited buffer that you used the 'next' command to leave. The EX mode command, tpu, allows you to execute arbitrary TPU statements from the editor. 2 Initialization VI allows you to use a file to initialize the options and settings that you wis h to use, automatically, each time the editor is envoked. Note that when you use VI in a subprocess, the initialization is done only when the subprocess is first created, and not on any subsequent attach operations. The file SYS$LOGIN:VI.INI can contain EX mode commands, one per line, that will be executed after the file(s) selected are loaded into buffers. Alternatively, the file may be located anywhere by defining the logical name, EXRC, to be the name of the file you wish to use for initialization (this name is the similar, minus a leading '.', to that used under UNIX). Also, if you have only a single line of initialization, then the process logical, EXINIT (again a holdover from UNIX), can be defined to be the line of initialization, and it will be translated, and the resulting text executed. This is generally faster than processing the EXRC file. 2 Ex_mode EX mode is entered by typing a ":" (or the DO key). From the ":" prompt, you can perform many different functions associated with changing the operation of the editor. EX mode also allows you to perform operations such as global search and replace, block deletion of text, and many other operations that are not easily described with a single keystroke. Below is a list of the commands that can be performed from EX mode. The term, l_spec, is a specification for a line of the current file, and takes the form of either a search pattern, as in: /foo/ or ?foo? an explict line number as in "5", or perhaps a relative line number as in ".+5" which means the current line, plus five lines. There are two other special characters, like ".", they are "$" which means the last line of the file, and "%" which means every line in the file. If you specify a range of lines by separating two l_specs with a ",", the first specification must indicate a line that preceeds the second specification. If not, the message, "Bad range of lines!" will be displayed, and the command will be aborted. 3 Abort_edit :q[uit][!] This command quits the editor. If "!" is not specified, and there are modified buffers, then you will be told so, and the command will be aborted. You must then either retype the command with a "!" (if you really want to ignore the modified buffers, and loose those changes), or you must write out the modified buffers. 3 Change_output_file :file Changes the output file specification of the current buffer to the specified file. This will result in the buffer being written to the new file whenever a ":w", ":xit" or "ZZ" command is issued. 3 Compile_TPU :[l_spec][,l_spec]tpu Compiles the indicated region, making the assumption, that the region contains TPU language code. 3 Copy_lines :l_spec_1,l_spec_2 c[opy] l_spec_3 The range of lines indicated by l_spec_1 and l_spec_2 are copied in their entirety, to the location after the line indicated by l_spec_3. 3 Create_buffers :b[uffer] [] [] This command maps the buffer named to the current window. If there is no buffer by the name given, then a new buffer will be created. If is given, the named file will be read into any newly created buffer. 3 Create_key_macro :map[!] Allows you to establish a mapping or macro for a single keystroke. If a "!" is specified then the mapping/macro is in effect during text entry mode, otherwise the mapping/macro is in effect during command mode. The next time that is typed in the affected mode, the string of keystokes specified will be substituted for the single key typed. ":map" with out any parameters displays the current mappings. 3 Delete_buffers :de[lbuf][!] This command allows you to delete a buffer by name so that it is no longer in existance. This will destroy the contents of the buffer. If the buffer is modified you can specify the "!" to assure the the buffer is deleted. Otherwise when the buffer is modified you will be prompted to make sure that you wish to delete that buffer. An unmodifed buffer will be deleted without any prompting, whether or not a "!" is specified. 3 Delete_lines :l_spec[,l_spec]d Delete the line(s) specified. 3 Edit_new_file :e[dit] This command allows you to switch to a different file that you want to edit. File spec is first compared to the name of an existing buffer. If there is a buffer by that name, then it is mapped to the current window. If not, then the indicated file will be read into a new buffer, which will be mapped to the current window. :vi This command is an alias for the e[dit] command. For more information see the description of that command. 3 Execute_command_file :so The specified file will be read, line by line, and each line will be interpreted as an EX mode command. 3 Fill_text_region :l_spec[,l_spec]fill The indicated lines will be filled, wrapped, and joined so that they are as full as possible. the left and right margin values will determine how long the lines are, and where they start and begin. 3 Goto_Line :l_spec[,l_spec] Goto the beginning of the line(s) specified. 3 Goto_tag_in_file :ta [tag] The tag specified, or if none, then the tag following the cursor is located in one of the files specified by the "tags" value. The associated file is loaded, or switched to, and the corresponding command executed. If the tag can not be located, then a diagnostic is issued. 3 Help :help Gives you access to this document as well as other VMS help topics from within VI. 3 Invert_case :l_spec[,l_spec]in[vert] The case of all alphabetic characters in the indicated region will be inverted. 3 Learn_Key_Strokes :learn Initiates a remember of keystrokes that allows a particular sequence of key strokes to be repeated at at a later time by typing a single key. This facility is similar to that provided by the :map command. The difference being that you must "know" the keys you want to type for the :map command. A learn sequence is remember as you type the keys and the associated actions are carried out. When you are done typing a learn sequence, then you should use CTRL-R to bind that sequence to the desired key. Note that :set undomap also pertains to how learned sequence behave when undo is performed. 3 Lower_case :l_spec[,l_spec]lo[wer] The case of all alphabetic characters in the indicated region will be changed to lower case. 3 Message_buffer :me[ssages] This command simply maps the TPU messages buffer to the current window so that its contents can be viewed. 3 Move_lines :l_spec_1,l_spec_2 m[ove] l_spec_3 The range of lines indicated by l_spec_1 and l_spec_2 are moved in their entirety, to the location after the line indicated by l_spec_3. 3 Next_file :n[ext] Moves the pointer in the list of files currently being edited to the next file. The buffer associated with that file will be mapped to the current window. 3 Perform_Macros :@ Executes the first line of the indicated named buffers as command mode commands. 3 Previous_file :p[rev] Moves the pointer in the list of files currently being edited to the previous file. The buffer associated with that file will be mapped to the current window. 3 Read_file_into_buffer :[l_spec]r[ead] Reads the contents of the specified file, and inserts it into the current buffer after the indicated line. If no line is specified, then the current line is used. 3 Rewind_file_list :rew Will reset the pointer in the list of files being edit to the first one. The buffer associated with that file will be mapped to the current window. 3 Select_regions :select Toggles the status of the select region that can be used in place of a range specified in one of the EX mode commands, as well as any of the, buffer altering, command mode editing commands. 3 Set_default_dir :cd Changes the default directory that that the editor process is running in. The new default directory is shown in the message window. :chdir Same as the cd command. 3 Set_options :set [no]option[=value] [...] Sets one or more options that dictate the behavior of the editor these options are described in full later. If the option is boolean in nature as is "wrapscan", then you must either specify "wrapscan" or "nowrapscan". If the option is variable in nature, as is "scroll", then you should specify "option=value" as in "scroll=21". 3 Show_buffers :show buffers Displays the list of currently active buffers that you have created for editing files. 3 Show_file_list :show files Displays the list of one or more files that matched the file spec that you last gave as the parameter to a "vi" or "edit" command. This list of files is used by the ":next", ":prev" and ":rew" EX commands to allow you to cycle through a list of files in a logical sequence. You can change the line that the cursor is on to change which file :next and :prev display by using, ^D ^U, h, j, k, and l key strokes. 3 Show_tags :show tags Displays the contents of the buffer that is used to resolve "tag" references. This can be used to make sure that you are specifying the proper tags. 3 Spawn_command :! Spawns a subprocess to run the given DCL command in. Note that due to limitations of TPU, there is no prompt asking you to "[Hit ENTER to continue]" before the screen is redrawn when the command finishes. Therefore, you will have to use ^S/^Q or HOLD SCREEN to pause the display. 3 Spawn_subprocess :sh (:dcl) Spawns a DCL subprocess that you can use to perform some DCL related task with, and then LOGOUT of. 3 Substitution :l_spec[,l_spec]s/from_re/to_re/[g][q] Perform the indicated substitution on the indicated line(s) of text. Note that '&' is a single character alias for the last substitution made (not including line specs or options). The [g] option causes every occurence on a line to be replaced. By default, only the first is replaced. The [q] option will cause the editor to pause and display the text matching the from_re, before each substition. You are given the opportunity to say whether or not the substitution is to be performed. 3 Text_Abbreviations :abbr Creates an abbreviation for the text given by . is a simple string of characters, e.g. ATT, and is a more complicated string as in, American Telephone and Tele- graph. ":abbr" by itself displays a list of the current abbreviations. :unabbr Removes a previously defined abbrev- iation that was defined with ":abbr". 3 Unmap_key_macros :unmap[!] Removes a previously established map. The "!" must be present if you wish to unmap a map that was made specifying the "!". 3 Upper_case :l_spec[,l_spec]upper The case of all alphabetic characters in the indicated region will be changed to upper case. 3 Write_buffer :[l_spec][,l_spec]w[rite][!] [] The indicated line(s) will be written to a file. The name of the file can either be specified, or will default to the current buffer. There are certain operations that are not permitted unless the "!" is typed following "w[rite]". If "!" is not present, you can NOT write all or portions of the buffer to a file that already exists, unless it is the file associated with the current buffer. Also, you can not write out a portion of the current buffer to it's associated file without specifying the "!". This protects you from unknowingly clobbering a file. :[l_spec][,l_spec]wq[!] [] This command is identical to typing a ":w" command followed by typing a ":q" command. See the descriptions of those commands for more details. 3 Write_and_exit :x[it] Is synomous with typing "ZZ" while in command mode. The contents of the current buffer will be written out if they are modified. All other buffers will then be examined, and you will be asked whether or not you wish to write out any other modified buffer. The ":set nowrite" command will force a modifed buffer to be ignored during this search. 2 Set_options The ":set", EX, command allows you to change the behavior of VI under certain circumstances. There are several characteristics that you may or may not wish to make use of. Therefore, these can be altered by setting options. Below is a list of options that you can set using the ":set" command. Some of these options are either ON or OFF, and some have values. The proper syntax for changing the option therefore varies, and is outlined with each option. 3 Auto_Send_to_DCL :set [no]senddcl Determines whether or not pressing while in the DCL buffer, and while in insert mode, causes the current line to be sent to the DCL subprocess. If senddcl is in effect, then pressing return while you are in the DCL buffer will cause the current line to be sent to the DCL subprocess. The line typed, as well as the output from the DCL command is part of the undo region that is deleted if you use undo after the DCL command output appears in the DCL buffer. See the HELP section on the DCL process for more information. 3 Auto_line_wrap :set wrapmargin=integer Sets the number of columns from the right margin at which VI will wrap text to the beginning of the next line. Normally, no wrapping is done, i.e. wrapmargin=0 is in effect. 3 Auto_write :set [no]autowrite Determines whether or not modified buffers are automatically written out when you map a different buffer to the window that a modified buffer is mapped to. 3 Case_insensitive_search :set [no]ignorecase Determines whether or not case is ignored during string search operations. Normally, case is ignored. 3 Change_file_list :set file[s] Changes the list of files to edit to be those specified by . should be a single filespec, or a comma separated list. 3 Error_bells :set [no]errorbells Determines whether or not a bell is sounded when certain errors occur. 3 Expand_tabs :set [no]tabs Determines whether or not tabs are expanded to the proper number of spaces as you type. "notabs" will cause tabs to be expanded. 3 Line_report :set report=integer Sets the number of lines at which VI will tell you what you did. E.g. if you type, 2yy, then VI will quietly yank 2 lines. If you type, 10yy, then VI will tell you "10 lines yanked", providing report is set to some number less than 10. The same thing occurs for deletion, and put operations. If more than 'report' lines are added/deleted, then VI tells you about it. Report is set to 5 by default. 3 No_write :set [no]write Modifies the internal TPU flags for the current buffer that tell TPU whether or not to ignore modifications to a buffer. This flag is examined during exit from VI to determine whether or not to prompt you to write out the buffer. ":quit" will ignore modified buffers that have this flag set. 3 Paragraph_delimiters :set paragraphs= Sets pairs of characters that are assumed to occur at the beginning of the line following a ".". It is usually the case that these pairs of characters are RUNOFF commands. In VI under UNIX, these pairs are NROFF formatting commands. A single character, as in .P, should be followed by a space in the string of pairs of characters. If a paragraph movement (i.e. } or {) fails to locate any of the specified patterns, then the next blank line will be searched for. 3 Regular_expression_use :set [no]magic Determines whether or not regular expressions are used in search strings. By default, regular expressions are used. 3 Screen_length :set window=lines Sets the length of the screen in lines that is used by VI. The UNIX version of VI chooses to use the bottom of the screen as the base of a small window. The TPU version uses the top of the screen. The maximum number of lines is terminal dependent, the minimum is 3. 3 Screen_width :set width=cols Sets the width of the current window to the specified value. The maximum setting is terminal dependent, while the minimum is left up to the user. 3 Scroll_amount :set scroll=integer Sets the default number of lines that the window scrolls when ^D or ^U is typed. This number can also be set by preceeding ^D or ^U with a count. 3 Section_delimiters :set sections= Sets pairs of characters that are assumed to occur at the beginning of the line following a ".". It is usually the case that these pairs of characters are RUNOFF commands. In VI under UNIX, these pairs are NROFF formatting commands. A single character, as in .P, should be followed by a space in the string of pairs of characters. There are some pairs of characters that are exceptions. The pair of characters, +c, really means a single '{' at the beginning of the line. The pair of characters, +f, really means the string, subroutine, or the string, function, anywhere in the line. The pair of characters, +t, really means the string, procedure, at the beginning of the line. If a section movement (i.e. ]] or [[) fails, then the next blank line will also be searched for. 3 Shift_width :set shiftwidth=integer Sets the number of columns that text is to be shifted by when the shift left or shift right commands are executed. .EL .if system .I-1 3 Show_settings .else system .send toc .ifnot global .hl 2 ^*Show settings\* .send toc .endif global .endif system .s .LT :set all Displays the current values of the options. 3 Tab_stops :set tabstops=integer Sets the number of columns on the screen that is used to represent a tabstop. The default is eight. 3 Tag_Case :set [no]tagcase Determines whether or not the case of a tag is recognized when searching for it. For case insensitive languages or facilities, set notagcase should be used, otherwise the default, tagcase, is sufficient. 3 Tags_files :set tags= Sets the list of files that are used to resolve tag references. Each file name should be separated by a space. 3 Type_ahead :set [no]update Determines whether or not an explicit TPU UPDATE is done after each keystroke. Normally, TPU will process typeahead by not updating the window until there is no typeahead. ":set update" will foil these attempts, and force an update to occur after each keystroke during command level processing. 3 Undo_and_maps :set [no]undomap Controls whether or not an attempt is made to make it possible to undo all buffer operations that occur during the execution of a map or learned key sequence (see the :map and :learn commands). Normally, maps are undoable because a copy of the entire buffer is saved before a map is executed. While editing large buffers, this makes it rather slow to use maps, so you can turn this feature off when it is deemed not necessary. 3 Wrap_on_search :set [no]wrapscan Determines whether or not search operations are continued at the end/beginning of a buffer by moving to the beginning/end, respecively. Normally, wrapscan is in effect. 2 Additional_key_strokes There are some additional key strokes available that pertain to using added features of this version of VI. Below is an outline of the added key strokes. KP0 Temporarily creates a window that is the size of the entire screen, and maps the current buffer to that window. Use KP1 (Delete window) to remove this window, and uncover the windows that were occluded by the created window. This command only works when there is more than one window on the screen. KP1 Delete the current window from the screen and release its space to one of the surrounding windows. KP2 Split the current window into two windows divided by a status line place at the line that the cursor currently occupies. KP3 Move down the screen to the next window. KP4 Shrink the size of the current window by one line, making the window above, or below larger. An attempt is made to shrink the window by pulling up the bottom line, if that fails, then an attempt is made to pull down the top line. If that fails, then the window can not be shrunk. KP5 Enlarge the current window by one line. The same algorithym as for shrink is used to determine how to alter the size of the window. KP6 Move up the screen to the next window. PF1 When using VI on a VT100 series terminal, it is not possible to have TPU recognize the ESCAPE character, ASCII 27, it its primary processing loop. When using a VT200 series terminal, this is circumvented by using F11 as if it were ESCAPE. PF1 provides this functionality for the VT100 series of terminals. PF2 PF2 envokes the help facilities available for VI. KEY BOARD KEYS USED CTRL-X The CTRL-X key is used to send a DCL command to the DCL subprocess that is bound to the DCL buffer. CTRL-R The CTRL-R key is used to remember a learn sequence any bind it to a key. The :learn command initiates the learning process. 2 Windows_and_buffers The multiple window features of this implementation of VI make it possible to view multiple portions of a single file, or different portions of different files simultaneously. It is also possible to yank/delete text from one window/buffer and place it into another buffer. To accomplish this, all named buffers, and numbered, deletion buffers are globally available. I.E. there are no buffers that are local to a buffer, with a single exception being the information pertaining to the undo operation. If you type 'u' while in a buffer different from the one that you made the last change in, you will see the message Undo not in this buffer. displayed at the bottom of the screen. For more information on using multiple buffers and window, consult the section on additional key strokes. 2 Display_differences Due to certain characteristics of the TPU screen management facilities, certain activities on the display differ from those found in UNIX VI. One difference is TPU's inability to display control characters in an expanded format, such as "^H" for a literal backspace character in the text. While commands are being entered in EX mode, you will see that control characters are displayed as "^?" where the "?" character is replaced by the appropriate character corresponding to the control character typed. This type of expansion is possible here, but it is not possible to do it in the text buffers displayed on the screen. If a key typed does not correspond to a printable ASCII character, then a backward question mark will be displayed when that key is typed. 2 Tag_files A tags file is a file that contains one or more lines each of which contains 3 columns of text. Each column is separated by exactly one tab character. The first column of text is the "tag" string. The second column is the file with which that tag is associated, and the remainder of the line contains an EX mode command that will perform an action associated with that tag. Usually, the action locates a specific line in the file that is associated with the tag. VI will position the cursor at the bottom of the buffer prior to execution the EX mode command. Typically, a tags file is used to locate the definition of a languange procedure, or text formatter macro. A simple tags file can be constructed by using a program to analyze the text of a file, and locate the lines that should be tagged. In the UNIX operating system, there is a program called CTAGS(1) that analyzes C language source files, and creates a 'tags' file that allows access to the function 2 Kept_Editors VAX/VMS and TPU support the notion of a "Kept Editor". A "Kept Editor" is a subprocess that can be ATTACH'd to and from at will. The PUB:[EXE]VI.COM command procedure takes care of all of the details of carrying out the operation of the "Kept Editor". It knows how to locate, and attach to an existing "Kept Editor", and how to automatically create a new one if there is not one running. 2 Other_Tpus If you wish to use other TPU applications, besides VI, then there is a program that can help in the negotiation of which CALL_USER routines and which section file to use. VI$ROOT:[SRC]VI.MAR is the source to this program. It translates the logical names VISECINI and VI$CALLUSER instead of the normal TPUSECIN and TPUCALLUSER logical names. VI$ROOT:[EXE]VI.CLD is a CLD file that you can use the "SET COMMAND" command on to make VI.EXE useable. You can make VI.EXE by using the command "@MAKE EXE" from within the VI$ROOT:[SRC] directory. Then you will need to use the command $ SET COMMAND VI$ROOT:[EXE]VI If you desire to use PUB:[EXE]VI.COM to run VI in a subprocess, then you should install VI.CLD into SYS$SHARE:DCLTABLES.EXE. See the Command Language Definition manual for more information on doing this, if you are no familiar with the procedure. This is necessary because the command tables are not propagated to a subprocess when it is created. 2 DCL_buffer There is a special buffer that is always associated with a DCL subprocess. The "DCL buffer" can be used as an alternate method of collecting DCL output if the filter_region (!) and read_from_command (:r!) capabilities do not fit your needs. Any line in any buffer can be sent to the DCL subprocess by placing the cursor on that line, and typing a ^X (Control-X). When you type ^X, several actions can happen. If you are not already in the DCL buffer, then the current window will be split, and the top window will be mapped to the DCL buffer, and you will be positioned there. In either case, the command will be copied into the DCL buffer, and will also be sent to the DCL subprocess. If the subprocess does not exist, then it will be created. There are several ways that any one of these steps can fail. If they do, and appropriate diagnostic will be issued to allow you to resolve the problem. The setable option, senddcl, allows you to use the DCL buffer interactively, somewhat. When senddcl is in effect, you can place yourself in insert mode, using A, a, I, i, R, O, or o, and then type a DCL command. When you press enter at the end of the line, that line is sent to the DCL subprocess as input. The output of the DCL command is placed into the DCL buffer as if you had typed it in addition to the command line. Thus, undo will allow you to remove both the command line, and the output from the DCL buffer with a minimum of trouble. 2 TPU_Bugs_Revealed There are several problems with TPU that cause problems with this implementation of VI. Outlined below are some of the more major problems. There are probably some that I have forgotten by now. Every place that there is a TPU statement of the form: EXECUTE (COMPILE ("vi$global_var := ....")); there is a statement preceeding that line that initializes vi$global_var to zero. This is necessary to get around a bug in TPU that causes the storage that vi$global_var is associated with before the EXECUTE (COMPILE ()), to not be disassociated. TPU would randomly scribble on string and buffer descriptors until it would stop with an "internal error, please SPR this", message. Another problems has to do with the KEY_NAME() values of keys. It appears that GET_INFO (DEFINED_KEY...) does not return proper KEY_NAME() values for certain keys. In particular, you will notice that maps to keys like q, v, and others will be displayed with the key as a backward question mark, instead of the proper letter, when you issue the :map command to display the current maps. This is currently (apparently) unsurmountable. Some trickery (hacking I like to call it) could be done to coerce the bogus key values into something reasonable, but I decided not to do that. Still another problem has to do with the fact that ASCII (CTRL_?_KEY) always returns ASCII(0) instead of ASCII(1) through ASCII(26) as would be convienent. I have written some code (hacks at best) to get around this problem by normalizing the values around the value of CTRL_A_KEY. An expression of the form: keyname-CTRL_A_KEY/(CTRL_B_KEY-CTRL_A_KEY) will result in a value of 0 through 25 when keyname has a value in the range of CTRL_A_KEY to CTRL_Z_KEY. This code is really bogus, but I did not see a more feasible way of doing this. KEY_NAME() values should really comprise another TPU data type so that ASCII could distinguish between those values and integer values. TPU's pattern matching code is mostly broken. The regular expression compiler in TPU generates TPU patterns that correspond to the RE's passed to it. The biggest problem with the TPU pattern matching is that it does not know how to back out of a match, and try an alternative. If two adjacent pieces of an RE have a non-null intersection, then they can cause a pattern match failure because the first pattern can consume a character that would match the second pattern, but the SEARCH() routine will not backout of a match once it has been made (even in the somewhat 'kludgy' incremental mode).