Buffer attributes, Ansi mode buffer attribute, The backup flag – Crunch CRiSP File Editor 6 User Manual
Page 34: The binary flag
Page 34
files which many other editors or standard utilities cannot cope with.
Buffer Attributes
Each buffer has a number of attributes or modes associated with it. The following is a summary of these
attributes, and the following sections explains the purpose of these attributes in further detail.
→
Ansi mode(pg. 34).
→
Backup flag(pg. 34).
→
Binary flag(pg. 34).
→
Buffer contents(pg. 35).
→
Buffer name, buffer ID and Filename(pg. 35).
→
Carriage-return flag(pg. 35).
→
Character maps(pg. 37).
→
Current cursor position(pg. 35).
→
Modified flag(pg. 35).
→
Permissions & Read-only Flag(pg. 35).
→
Process Buffers(pg. 36).
→
Region marker(pg. 36).
→
Symbol table(pg. 36).
→
System Buffers(pg. 36).
→
Tab settings(pg. 36).
→
Undo information(pg. 36).
Ansi Mode buffer attribute
Ansi mode is a special mode normally used with process buffers, in which Ansi escape sequences
embedded within a buffer are interpreted and displayed correctly, rather than being displayed literally. For
example, the string "
compatible terminal) to set the foreground color to dark blue. When ansi mode is set, all characters to the
right of the escape sequence will actually appear dark blue. This facility is used mainly for process buffers
where some program is run which uses Ansi color sequences and cursor movement facilities. This mode
allows CRiSP to display the screen output in a window correctly. For example, it is possible to use the 'vi'
editor inside a process buffer.
Ansi mode can be used independently of a process buffer, for example to review output from a program
which uses these escape sequences.
Another possibility, not yet presently implemented in CRiSP, is to write a macro which changes the colors of
keywords in the buffer, e.g. in a C program comments could be in green, and keywords in cyan. (This is
really only feasible if the text within a buffer is easily parsable).
Another use is to look at the system manual pages inside a CRiSP buffer. Normally looking at the output of
the man(1) command is a bit difficult because of the underlinings.
The ansi macro can be used by the user to turn on or off the ANSI attribute for a buffer.
The Backup Flag
When a file is read in to a new buffer, a flag is set, called the backup flag, which is used to indicate that
when the buffer is saved a backup of the file should be made (either in the backup directory as specified by
the set_backup() primitive or with a .bak file extension). This backup is only made once during each editing
session. This allows the user to make lots of changes to a file and save it frequently and still be able to
access the previous version of the file before editing started.
This flag may be set or cleared by a user macro, e.g. if the user doesn't want a backup made for a particular
file, or maybe the user wants backups to be made after the file is written away each time.
This flag is used by the rebackup mechanism to allow changed buffers to force creation of new backups
after a specified period. (Refer to the description of the autosave variable in the .crinit file in the User Guide.
The Binary Flag
When a file is read into a buffer, CRiSP tries to determine whether the file is a text file or a binary file. CRiSP
can handle either, but response can become sluggish when lines are very long. (CRiSP can handle infinitely
long lines, but it is expensive to compute how long they are for screen purposes). To make it easier to edit