Saving the Edit STATE
Contents of Article
When working on a file, particularly files such as source files, a fair amount of effort may be expended on establishing line-labels to act as bookmarks, setting line tags to mark particular lines and excluding various ranges of lines so that only the current pertinent lines are visible and being worked on. As well, you may have added NOTE lines to the file.
Your work on a large source program might continue over an extended period of many days. But every time you close the editor, all that effort noted above would normally be lost, and has to be re-established the next time the file is loaded for edit.
SPFLite can now save all the above as STATE information and automatically re-establish the edit session when the file is loaded back to its status when closed. Line labels, line tags, NOTE lines, excluded line ranges and current top of screen location are all retained on close and recreated when the file is opened. The file is redisplayed exactly as you left it at close time.
This action is often called "reestablishing the edit context". By doing this, it eliminates the work of you having to do all of that manually, and will greatly aid your productivity. You'll spend less time going, "where was I, what was I doing?" and you'll be able to resume your work much more quickly.
So for source files, STATE seems a nice feature, and since STATE is a setting maintained in the file type Profile, you can have STATE set ON for source file types where it is appropriate, and OFF for file types where it would provide no benefit.
You can now also have selective STATE processing within a single file type. Continue reading and pay attention to STATE Setting Options below.
In order to make sure the saved STATE information is properly synchronized with the file it's associated with, there are calculated hash values kept in the STATE file. If the validation of these values fails when the file is opened, the STATE information will not be used, and you will receive an error message.
This can happen if you use an external program to modify the file, or another editor to insert, delete or move lines around in the file. For example, if you created a label of .ABC on line 10 of a file, and then modify the file with an outside editor, the label .ABC can no longer be reliably used to reference line 10, because the underlying data on that line is (probably) not the same any more.
An invalid STATE condition can happen if you restore or copy a file from another location, such as a backup, or download a copy from a web site. When SPFLite detects this, it will not use any saved STATE information.
STATE now supports multiple operand options to allow you to customize how STATE processing is handled. These operands are:
STATE ON This indicates that you would like all files controlled by this Profile to be processed by STATE.
STATE OFF This indicates that no files controlled by this Profile are to be handled by STATE.
STATE MOST This is similar to STATE ON. If you take no specific action for a specific file, then it acts just like STATE ON, all files will be processed by STATE. However it supports allowing you can exempt specific files, see STATE DELETE below.
STATE FEW This is similar to STATE OFF. If you take no specific action for a specific file, then it acts just like STATE OFF, all files will not be processed by STATE. However you can exempt specific files, see STATE CREATE below.
STATE DELETE This command would be issued while editing a specific file and STATE MOST has been set. In fact, it will be rejected if these conditions are not met. Since STATE MOST, by default, will have created active STATE data for this file, the STATE DELETE will remove this active data and setup an indicator so that no future STATE processing for this file will occur.
STATE CREATE This command would be issued while editing a specific file and STATE FEW has been set. In fact, it will be rejected if these conditions are not met. Since STATE FEW, by default, will not have created any active STATE data for this file, the STATE CREATE will cause this active data to be created the next time the file is saved, and will setup an indicator so that STATE processing will continue for this file in future edits.
Whether or not your editing context is saved for you or not is controlled by a Profile setting called STATE. If you issue a PROFILE (or just PRO) command, here is what the display might look like:
Notice the =PROF> line that says STATE ON. In this example, this means that for files of type TXT, state information will be saved. Note also that S+ appears in the Status Bar indicating that an active STATE file exists for this file.
NOTE and xNOTE lines require STATE ON to be in effect if you wish these lines to be retained between edit sessions.
Some (but but not all) options of START (which relies on a persistent label of .START) also require STATE ON.
The state information for a given file is saved in a separate file within the STATE folder in the SPFLite data directory. Since STATE data is normally related to your current work with a file, STATE files which have not been updated for 180 days will be automatically purged from the STATE folder. This will prevent the accumulation of obsolete STATE files which are no longer of any use.
Created with the Personal Edition of HelpNDoc: Easily create Qt Help files