I have discontinued development of this product and will no longer provide technical support or bug fixes for it. However, it is still available for sale at a reduced price of $25.00 if you do want the source code. To order, please disregard the order form information in the ZIP file and click on the Buy Now link below. I can accept payments, including by credit card, via PayPal. Thank you!


This library provides a set of classes that can be used for text editing. Anyone familiar with TVMEditor should see several similarities between it and CVMEditor. For those who are not familiar with it, TVMEditor was my text editor class library for Borland's now defunct Turbo Vision user interface library. It made its debut in the 16-bit DOS world and evolved to support 16-bit and 32-bit protected mode. Most of the underlying code for the editor class and the virtual memory system became the basis for CVMEditor, which is currently implemented for the 32-bit Windows platform only. However, it still uses the same class to provide its virtual memory and text storage. As such, it allows the ability to limit how much physical memory it will use and can swap to disk if necessary. The one major difference between the two is that I have made a definite split between the editor code and the user interface code.

The CVMEditor class now serves as a text-editing engine providing all of the text storage and manipulation code along with optional hooks to be used by any type of user interface library. The base class can be used for loading and manipulating text files programmatically in any type of application from small console mode applications to full-blown GUI applications. By deriving a class from CVMEditor and implementing the user interface hooks, it should be possible to plug it into just about any user interface library. Currently, I have only implemented a set of classes to provide support for MFC applications developed with Visual C++.

Feature List

The basic CVMEditor and derived classes support the following features:

  • They support virtual memory and can therefore load extremely large files (up to 128 MB).
  • Because they can load large files, they also support more than 32,767 lines in a file. The total number of lines is limited only by the amount of free virtual memory.
  • They have all the basic editing features and numerous extensions have been made to the basic movement and editing keys.
  • The key mappings are implemented as accelerator tables in the application's resource file. As such there is an added capability to alter or extend the keyboard command sets at runtime.
  • Additional editor option settings have been added. They have been grouped into a global scope for all editors to use and a local scope for use by each editor instance. Global options affect all editors and local options affect only the editor to which they belong. Each new editor will inherit the currently defined global options upon creation.
  • Line jump: Go to a specific line, +/- a number of lines, previous line, last edited line, and there is support for unlimited user-definable bookmarks.
  • Hard and soft tabs with variable tab size. Also has the option to convert hard tabs to soft tabs (spaces) at load time.
  • Support for Enter Matching on (, [, {, `, ", and <. You can enable or disable this feature for any or all of them through local option settings.
  • There is also support for Find Matching on ( ), [ ], { }, and < > pairs starting on either character in the pair going in either direction across multiple lines. Find Matching can also be done for " and ` but the matching search will go in the forward direction only and will be limited to the same line.
  • The selected block of text can be persistent or non-persistent in nature. A persistent block allows you to mark text and move away from it without losing it. Either block type can be marked via several different key sequences or the mouse. Block extension is also supported via Shift+Clicking the mouse. Double clicks can select a word and triple clicks can select a line.
  • Improved search and replace options: Forward or backward within selected text or the whole file, search from cursor or entire scope (from one end of the file or selected text to the other). Searches up to 750K or more per second depending upon the PC in use and the location of the virtual memory (physical memory or disk).
  • Supports word wrapping, paragraph reformatting, character case switching, line centering, and text alignment as needed. Certain commands use the current line if there is no block selected. This is useful when you only want to operate on one or two lines.
  • Additional Move Block and Copy Block functions were added that do not require the clipboard.
  • Supports unlimited Undo/Redo.
  • When two or more editors are viewing the same file, they can share the same single virtual memory buffer between them.
  • Buffer clearing and file reload via a single call to the doneBuffer() function.
  • By adding the necessary code to an editorDialog() callback function and issuing a CVM_RESYNCHxxxx command, you can have the file editors automatically reload their file from disk if it is no longer current after such things as executing external programs or switching back to the application or view.
  • If the efSetROonLoad bit is set, the editor will check the Read Only access flag on the file and, if set, will make the editor Read Only as well to prevent altering the file.
  • Text retrieved from the buffer can be separated in a more natural format for easier parsing by the programmer. Lines can be separated by nulls, line feeds, or carriage return-line feed pairs.
  • Support for an application-defined auto save feature is built into the editor class.

The derived classes for MFC include the following features:

  • Support for changing the font.
  • Word wrapping can be based on the font size and view width.
  • Basic support is included for printing the entire file or just the selected block of text. The ability to print preview is also available.
  • The dialog control supports all the features of CVMEditor including the ability to read/write blocks of text to/from files. It also supports the standard DDX mechanism for dialog boxes to transfer data to and from a CString.
  • The view and dialog control both support an optional gutter in which to display tags and icons for such things as bookmarks, breakpoints, etc.