\input texinfo  @c -*-texinfo-*-
@c Copyright (C) 1996,1997 by Salvador Eduardo Tropea.
@c The first 75 lines configures all, the rest is the real doc.

@comment %**start of header

@setfilename editor.info
@set version 0.2.18b
@set update-date 15 July 1997
@set update-month July 1997
@set name-author Salvador Eduardo Tropea

@set rh Robert H@value{ouml}hne
@macro RH{}
@value{rh}
@end macro

@settitle SET's editor v @value{version}
@footnotestyle separate
@paragraphindent asis
@iftex
@afourpaper
@end iftex

@comment %**end of header

@c ---- Includes according to the output format
@ifset html
@include set.htm
@clear text
@end ifset

@ifset text
@include set.txt
@clear html
@end ifset

@ifclear html
@ifclear text
@include set.txi
@end ifclear
@end ifclear

@macro SSET{}
@mail{@value{name-author},salvador@@inti.edu.ar}
@end macro
@set title-printed SET's Editor
@set minidesc-printed @sc{An editor for programmers}
@set year-copyr 1996, 1997
@set info-file  editor.info

@macro ikey{KEY,DESC}
@key{\KEY\}
@kindex \DESC\ | @key{\KEY\} |
@end macro

@c --------------------------------------------------------------
@c Now we have 3 different headers:
@c 1) For the printed manual, is called titlepage
@c 2) For Info files
@c 3) For HTML files
@c I tried to automate it.
@c --------------------------------------------------------------

@set text-pre1 @ @ @ This document describes the use of the SET's editor; this editor was designed for programmers and to be used alone or inside of the RHIDE.

@set text-pre2 @ @ @ This documentation may be freely distributed with the editor or the RHIDE package or any part thereof, provided this copyright notice is left intact on all copies.

@set text-pre3 @ @ @ Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.

@macro lista1
@itemize @bullet
  @item @sc{@value{rh}} <Robert.Hoehne@@Mathematik.TU-Chemnitz.DE>@*
    (with some base routines, a lot of patches and reports)

  @item @sc{Molnar Laszlo} <molnarl@@cdata.tvnet.hu>@*
    (with the calculator, tests and a lot of ideas)

  @item @sc{Marek Habersack} <grendel@@ananke.amu.edu.pl>@*
    (with tests and a lot of ideas)

  @item @sc{Frank Donahoe} <fdonahoe@@wilkes1.wilkes.edu>@*
    (with a lot of corrections to this text)
@end itemize
@end macro

@macro titem4{NOM,COM,KEY,ALT}
@titem_{\NOM\,\COM\,\KEY\,\ALT\}
@kindex \COM\ @key{\KEY\}
@kindex \NOM\ @key{\KEY\}
@end macro

@macro titem3{NOM,COM,KEY}
@titem_{\NOM\,\COM\,\KEY\}
@kindex \COM\ @key{\KEY\}
@kindex \NOM\ @key{\KEY\}
@end macro

@HeaderPage1{}
@ifinfo
@ifset html
@include editor.ctx
@end ifset
@top EDITOR
@end ifinfo
@HeaderPage2{}

@chapter Introduction

@value{text-pre1}
@paragraph{}

@value{text-pre2}
@paragraph{}

@value{text-pre3}
@paragraph{}

  People who helped me develop the editor:
@paragraph{}

@lista1{}

  The editor is freeware, but the source-code of this editor is copyrighted
by @value{name-author}.
If you want to include the editor in your application, using the whole code
or only a part contact at first @mail{me,salvador@@inti.edu.ar}
@paragraph{}

  This editor is included in the @RH{}'s RHIDE as a replacement for the
original TVision's editor class.
@paragraph{}

@c when using something like What's, TeX is confused by the '
@section What is SETs Editor?

  SET's editor is an editor designed to be used by programmers; the main
target of the editor is C and C++ code but Pascal and Clipper are supported
too.
@paragraph{}

  The editor was designed to be very similar to the DOS standard editors for
C, especially to Borland's IDE editor. The editor supports a lot of
WordStar style commands plus some CUA commands, so if you have used any editor
that uses these kinds of commands you'll find my editor very familiar. On the
other hand if you have never used a DOS editor, especially if you use VI on UNIX
machines you'll feel lost. You can configure the keyboard but this
feature is relatively limited. @x{How to configure the keyboard}.
@paragraph{}

@section Requirements

  For now I only plan to distribute my editor inside of RHIDE.
Requirements are the requirements of RHIDE.
@paragraph{}

@section About the Author

@my_flag{}

The editor was created by @value{name-author} with some code contributed by
@RH{}

@display
E-Mail: @SSET{}

Telephone: (+541) 759-0013
Postal Address:
Salvador E. Tropea
Curapalig@value{uuml}e 2124
(1678) Caseros - 3 de Febrero
Prov: Buenos Aires
Argentina
@end display
@paragraph{}

@my_flag{}

@chapter Available commands

  In this section I will explain the features of the editor and the default
configuration for the keyboard. If you want to change some assignment
of a key consult "configure the keyboard".  @x{How to configure the keyboard}.
@paragraph{}

  Read the conventions topic first to understand my way of indicating
keystrokes.
@paragraph{}

  In the description of each command I'll include the internal name used by
the editor because this name is needed to configure the keyboard.
@paragraph{}

@section Conventions

  I'll use some conventions when talking about the keystrokes needed to
trigger some command. So here is what I use:
@paragraph{}

  The key named @key{Ctrl} or Control is represented as @samp{^}; this key doesn't have any
effect used alone inside of the editor so the @samp{^} symbol will be used only
in conjunction with the name of some key indicating that you must press the
two keys at the same time. For example, @kbd{^A} is @key{Ctrl} and @key{A} at the same time.
When I say "at the same time" that means: press @kbd{@key{Ctrl}}, hold it, and press
the other key; that's the reason to put @key{A} after @key{Ctrl}.
@paragraph{}

  To indicate a sequence of keystrokes I'll use a dash to separate the keys. For
example, @kbd{^K-B} is @key{Ctrl} and @key{K} at the same time, and then press @key{B}, of course
release @kbd{^K} first.
@paragraph{}

  To indicate keys pressed at the same time other than @kbd{^x} I'll use a plus.
For example, @kbd{Shift+^Insert} is the three keys at the same time!
@paragraph{}

  I don't think that you are stupid; the editor is written for programmers,
but I wanted to make that clear to avoid problems ;-).
@paragraph{}

@section Cursor movement
@cindex Movement

@table4{Action,Command,Key,Alternate}
@titem4{Character left,cmbCharLeft,Left arrow,^S}
@titem4{Character right,cmbCharRight,Right arrow,^D}
@titem4{Word left,cmbWordLeft,^Left arrow,^A}
@titem4{Word right,cmbWordRight,^Right arrow,^F}
@titem4{Line up,cmbLineUp,Up arrow,^E}
@titem4{Line down,cmbLineDown,Down arrow,^X}
@titem3{Scroll the screen one line up,cmbScrollUp,^W}
@titem3{Scroll the screen one line down,cmbScrollDown,^Z}
@titem4{Page up,cmbPageUp,PgUp,^R}
@titem4{Page down,cmbPageDown,PgDn,^C}
@titem4{Beginning of line,cmbLineStart,Home,^Q-S}
@titem4{End of line,cmbLineEnd,End,^Q-D}
@titem4{Top of window,cmbFirstLineInScreen,^Q-E,^Home}
@titem4{Bottom of window,cmbLastLineInScreen,^Q-X,^End}
@titem4{Top of file,cmbTextStart,^Q-R,^PgUp}
@titem4{Bottom of file,cmbTextEnd,^Q-C,^PgDn}
@endtable_{}

@section Insert and Delete
@cindex Insert and Delete

@table4{Action,Command,Key,Alternate}
@titem4{Delete the character under cursor,cmbDelChar,Del,^G}
@titem4{Delete character to left,cmbBackSpace,Backspace,^H}
@titem3{Delete line,cmbDelLine,^Y}
@titem4{Delete to end of line,cmbDelEnd,^Q-Y,Shift+^Y}
@titem3{Delete to start of line,cmbDelStart,^Q-H}
@titem3{Delete word at left,cmbDelWord,^T}
@titem3{Delete word at right,cmbDelPrevWord,^Backspace}
@titem4{Insert line,cmbNewLine,Enter,^N}
@titem4{Insert mode on/off,cmbInsMode,Ins,^V}
@endtable_{}

  When you are in insert mode all the typed characters are inserted in the
text, but when the insert mode is off the typed characters replace the
old text. The editor starts with insert mode on. You can quickly know the
mode by the cursor shape. When the insert mode is on, the cursor is only a
line, but when it is off, the cursor is block shaped.
@paragraph{}

@section Blocks
@cindex Blocks

  A block is a selected portion of the text. You can copy, delete, @i{etc.@:} blocks
of text. The associated commands are:
@paragraph{}

@table4{Action,Command,Key,Alternate}
@titem3{Move to beginning of block,cmbGoBeginBlock,^Q-B}
@titem3{Move to end of block,cmbGoEndBlock,^Q-K}
@titem3{Set beginning of block,cmbStartSelect,^K-B}
@titem3{Set end of block,cmbEndSelect,^K-K}
@titem3{Hide/Show block,cmbHideSelect,^K-H}
@titem3{Mark line,cmbMarkLine,^K-L}
@titem3{Mark word,cmbMarkWord,^K-T}
@titem4{Delete block and copy it to the Clipboard,cmbCut,^K-Y,Shift+Del}
@titem3{Copy the selected block,cmbCopyBlock,^K-C}
@titem3{Move block,cmbMoveBlock,^K+V}
@titem3{Copy to Clipboard,cmbCopy,^Ins}
@titem3{Delete block,cmbClear,^Del}
@titem3{Paste from Clipboard,cmbPaste,Shift+Ins}
@titem4{Read block from disk,cmbReadBlock,^K-R,Shift+^R}
@titem4{Write block to disk,cmbWriteBlock,^K-W,Shift+^W}
@titem3{Replace the block by the Clipboard block,cmbReplaceSelect,Shift+^Ins}
@titem3{Convert to Uppercase,cmbToUpper,^K-M}
@titem3{Convert to Lowercase,cmbToLower,^K-O}
@titem3{Report the length of the block,cmbSelLength,^Q-L}
@endtable_{}

@subsection Block modes
@cindex Persistent Blocks

  There are two block modes. One is the mode that the old editor of RHIDE
used. This mode is used in CUA programs. The other is called Persistent
Blocks.
@paragraph{}

  In the normal mode each time you select a block and then insert anything
in it (with @code{cmbPaste} or by typing anything) the selected block is deleted
and is replaced by the new text.
@paragraph{}

  In persistent blocks the selection is not replaced and is not lost when
you move the cursor. From this comes the name "Persistent." In this mode
you can use @code{cmbMoveBlock} and @code{cmbCopyBlock} without using the Clipboard. In
addition you can apply indentations to the block (@x{Indentation}),
search only inside it, @i{etc.} That's what makes this mode much more powerful than
the former. If you really like to replace the selected text by the selection
of the Clipboard, that's the default behaviour of the first mode. You can use
the @code{cmbReplaceSelect} command to achieve the same in the Persistent Blocks
mode.
@paragraph{}

@subsection Selecting with the mouse or Shift

  The described commands for selecting a block, @code{cmbStartSelect} and @code{cmbEndSelect},
are good but not so quick. There are other ways to do this.
@paragraph{}

@subsubsection Using the mouse

  Using the mouse you need only point to the start place, hold the left button
pressed and move the mouse to the end point of your block.
@paragraph{}

  To select a word with the mouse just double click on it.
@paragraph{}

@subsubsection Using the Shift key

  Using the @key{Shift} key you only need to move the cursor to the start point,
hold @kbd{@key{Shift}} pressed and move the cursor to the end point with any of the
available cursor commands. @x{Cursor movement}.
@paragraph{}

@subsection Indentation
@cindex Indentation

  You can indent or unindent a block of text using various commands, but you
must keep in mind that for now the editor is limited in the following:
@x{Real Tabs} If you are using tabs to indent your text, don't mix the tabs with
spaces and, if you are using spaces to indent, don't mix them with real tabs.
@paragraph{}

@table4{Action,Command,Key,Alternate}
@titem4{Indent block one position adding a space,cmbIndentBlkOne,^K-I,Shift+^I}
@titem4{Unindent block one character - not an x position,cmbUnIndentBlkOne,^K-U,Shift+^U}
@titem3{Indent block,cmbIndentBlk,^K-Tab}
@titem3{Unindent block,cmbUnIndentBlk,^K-Shift+Tab}
@titem3{Smart Indent block,cmbSmartIndent,^Tab}
@titem3{Smart Unindent block,cmbSmartUnIndent,Shift+^Tab}
@endtable_{}

@code{cmbUnIndentBlkOne} unindents deleting one char at the start of the line so
if the line is indented with tabs the line will retract one tab.
@paragraph{}

@code{cmbIndentBlk} acts according to the mode. If you are using tabs,
the editor will put one tab beginning each line. If you aren't using tabs the
editor will operate the Tab command on the first line and then will use
this amount of indentation on the entire block. @x{Real Tabs}.
@paragraph{}

@code{cmbUnIndentBlk} acts according to the mode too. @x{Real Tabs} mode. This is
just like @code{cmbUnIndentBlkOne} deleting one tab but if you don't use tabs the
editor uses Backspace on the first used column of the first line of the
block and unindents by the resulting amount all the block.
@paragraph{}

@code{cmbSmartIndent} and @code{cmbSmartUnIndent} indents taking as reference the @{ @} pair
where the block is, for example:@*
@example
  @{
line1
     line2
   line3
  @}
@end example
After indenting a block that contains line1 to line3 is:@*
@example
  @{
   line1
   line2
   line3
  @}
@end example
The indentation is made with spaces.
@paragraph{}

@subsection Rectangular Blocks
@cindex Blocks - Rectangular

  The editor includes a mode where you can select a rectangular portion of
the text and copy, cut, clear, paste, move, @i{etc.@:} this region.
This tool is very useful for modifications on columns.
@paragraph{}

  Attention! The selected area is based on the X,Y coordinates. For this
reason if you insert lines before the bottom of the rectangle the area won't
be moved. I don't plan to move the area by now because that takes some CPU
and I think that this selection is made just before using it. So don't
report that like a bug. That is the way it works!
@paragraph{}

@table3{Action,Command,Key}
@titem3{Set beginning of block,cmbSelRectStart,^K-Shift+B}
@titem3{Set end of block,cmbSelRectEnd,^K-Shift+K}
@titem3{Hide/Show block,cmbSelRectHide,^K-Shift+H}
@titem3{Delete block and copy it to an special Clipboard,cmbSelRectCut,^K-ShiftT}
@titem3{Move block,cmbSelRectMove,^K+Shift+V}
@titem3{Copy to special Clipboard,cmbSelRectCopy,^K-Shift+C}
@titem3{Delete block,cmbSelRectDel,^K-Shift+L}
@titem3{Paste from special Clipboard,cmbSelRectPaste,^K-Shift+P}
@endtable_{}

@section Pseudo Macros
@cindex Pseudo Macros
@cindex pmacros.txt

  This feature is very useful to save some keystrokes. With this feature you
can create a lot of shortcuts to make your life easiest.
@paragraph{}

@subsection Please enlighten me - what is that?

  So now, What's a Pseudo Macro? It's like a macro but is triggered by two
things: one the text behind the cursor, and two the @kbd{^Space} combination.
@paragraph{}

  And what's the result? The result is customizable, but by default there are
some predefined behaviours. For example, type in a new window the following
two characters: @kbd{#i} and the press @kbd{^Space} @dots{}
@paragraph{}

  Surprised? I bet! You got: #include <.h> and the cursor just in the right
place to write the name of the header.
@paragraph{}
Now write the famous stdio word, press @kbd{@key{End}}, then @kbd{@key{Enter}} twice and now write
the following two letters: @kbd{ma} and then @kbd{^Space} @dots{}
@paragraph{}

  I bet this time you predicted better what will happen so you aren't so
surprised ;-). Anyways, Surprise! Now type @kbd{pr} and the magic keys and @dots{}
@code{printf("");} appears. To end the happy history now type "Hello world!" That's
all. You wrote the hello world program at a very good speed.
@paragraph{}

  Now you know what I mean when I say pseudo-macros.
@paragraph{}

@subsection How can I customize that?

  Is very easy. There is a file called @file{pmacros.txt} in the same directory
where you started the editor. This file contains the definitions for each
pseudo macro. You can define up to 32 pseudo macros. (Please tell me if that
isn't enough. I can sacrifice some time to make it dynamically expandable).
@paragraph{}

  Important: If you are using RHIDE consult the RHIDE documentation to know
where is stored the @file{pmacros.txt} file.
@paragraph{}

  The @file{pmacros.txt} file is a very good example and is self-explained but I'll
include here one example.
@paragraph{}

@format
Trigger: "i("
Mode: 0,1,0,1,0
 "if (@@0)\n"
 "  @{@@1\n"
   "@}\n"
 "\belse\n"
 "  @{@@2\n"
   "@}"
@end format

  The Trigger keyword defines the two letter behind the cursor that will
trigger the pseudo macro.
@paragraph{}
  The Mode keyword indicates the mode that the editor will use when inserting
the text. The modes are:
@paragraph{}

@itemize @bullet
  @item Overwrite               @x{Overwrite}
  @item Autoindent              @x{Autoindent}
  @item Use Tabs                @x{Real Tabs}
  @item Persistent blocks       @x{Block modes}
  @item Intelligent C indent    @x{Intelligent C indent}
@end itemize

  Each mode can be 0 or 1. The editor will return to the original mode after
expanding the pseudo macro. In this case the macro is expanded in the No
overwrite, autoindent, don't use tabs, the blocks are persistent
and don't be smart when indenting.
@paragraph{}

  The rest is the code to insert surrounded by ". You can use \b to indicate
backspace, \n for newline and \\ to indicate a simple \. If you want to
insert a @@ you have to type it twice @@@@, because this character
has a special meaning (see below).
@paragraph{}

  After the insertion the cursor is positioned in the place marked with @@0.
Don't forget to signal this point or the cursor will positioned at the
beginning of the file. The places marked with @@1, @@2 and @@3 are saved in
the markers 7, 8 and 9.
@paragraph{}

@section Miscellaneous

@table3{Action,Command,Key}
@titem3{Autoindent mode on/off,cmbIndentMode,^O}
@titem3{Find place marker,cmbGotoMarkn,^Q n*}
@titem3{Set marker,cmbPutMarkn,^K n*}
@titem3{Search the open curly bracket where the cursor is,cmbSearchStart,^[}
@titem3{Search the close curly bracket where the cursor is,cmbSearchEnd,^]}
@titem3{Search the ( where the cursor is,cmbSearchOpPar,Shift+^9}
@titem3{Search the ) where the cursor is,cmbSearchClPar,Shift+^0}
@titem3{Search the [ where the cursor is,cmbSearchOpCor,Shift+^[}
@titem3{Search the ] where the cursor is,cmbSearchClCor,Shift+^]}
@titem3{Undo,cmbUndo,Alt+Backspace}
@titem3{PMacro's Trigger,cmbExpandCode,^Space}
@titem3{Goto Line,cmbGotoEditorLine,^J}
@titem3{Set the options of the current window (Not in RHIDE),cmbSetLocalOptions,Alt+L}
@titem3{Set the default options (Not in RHIDE),cmbSetGlobalOptions,Alt+G}
@titem3{Convert all tabs in spaces,cmbExpandAllTabs,From menu}
@titem3{Compact the text using tabs,cmbCompactBuffer,From menu}
@titem3{Start recording a macro,cmbRecordMacro,Shift+F10}
@titem3{Stop recording a macro,cmbStopMacro,Alt+F10}
@titem3{Play a macro,cmbPlayMacro,^F10}
@endtable_{}

@chapter Keyboard

  The editor uses the scancodes of the keys to trigger the different commands.
You can reconfigure which key triggers some command. In addition some non-US
keyboards can mess the commands so you could need to configure the editor
for your keyboard.
@paragraph{}

@section How to configure the keyboard
@cindex keybind.cc
@cindex keybind.h
@cindex keybind.txt

  There are three associated files with the keyboard: @file{keybind.cc},
@file{keybind.h} and @file{keybind.txt}.
@paragraph{}

  The @file{keybind.h} file contains the scancode number for each key and the number
for each command. This file is included in @file{keybind.cc}. If your keyboard
has a different assignment you can modify the scancodes in this file. For
example, the German keyboards have the following sequence QWERTZ instead of
the more common QWERTY, so each time you press @kbd{^Z} you won't get the
function of @kbd{^Z}, but of @kbd{^Y} instead. Some can live with it, but it is fixable.
To fix this problem you must correct the scancode of the Z key in @file{keybind.h.}
But of course this affects @kbd{^Y} too. That's only an example. The most
common problem is with the symbols like @{, @}, [, @i{etc.}
If you don't know how to find the scancode of a key take this link.
@x{A program to find the scancodes}.
@paragraph{}

  The @file{keybind.cc} file is a C++ file but you don't need to compile it and link
with the editor, you only need to preprocess it (I used this method to
save the time needed to make a parser ;-).
@paragraph{}

  To convert this file into a @file{keybind.txt} file use:

@example
cpp keybind.cc > keybind.txt
@end example

Where cpp is the C++ preprocessor. Any of the comment systems available in C++
may be used, as cpp does not pass comments to the file, @file{keybind.txt}.
I guess that you have cpp, but if not you can use another C++ preprocessor
or even Clipper using the /P switch.
@paragraph{}

  There are seven sections in the file, each section is the keyboard translation
under certain situation.@*
The sections are:
@paragraph{}

@table2{Section,Contains}
   @titem_{@samp{NORMAL},The single key press.}
   @titem_{@samp{SHIFT},Shift plus a key.}
   @titem_{@samp{CONTROL},Control plus a key.}
   @titem_{@samp{SHIFT_CONTROL},Shift plus control plus a key (all at the same time).}
   @titem_{@samp{QUICK},A key after @kbd{^Q} or whatever you defined as @code{cmbCtrlQ}.}
   @titem_{@samp{BLOCK},A key after @kbd{^K} or whatever you defined as @code{cmbCtrlK}.}
   @titem_{@samp{BLOCK_SHIFT},A key plus shift after @kbd{^K} or whatever you defined as @code{cmbCtrlK}.}
@endtable_{}

   In each section you must put the keyboards and the command associated to it.@*
   Use the following syntax:
@example
Scan_Code = Command
@end example
Not all the scan codes are available. For example, you can't put:
@example
RSHIFT = xxxxx
@end example
   Look at @file{keybind.h} to see the scan codes labels and the available commands.

Important Notes:@*
I)@*
  The new assignments are mixed with the original assignments, so if you
want to eliminate an old key combination you *must* assign a @code{cmbNoCommand}
to this key. For example, if you wish eliminate the BACKSPACE key and use the
@kbd{^O} instead, you must:
@enumerate 
@item
put @code{BACKSPACE = cmbNoCommand} in the NORMAL section,
@item
put @code{O = cmbBackSpace} in the CONTROL section.
@end enumerate
@sp 1
If you only do part two, you'll not eliminate the BACKSPACE key.
@paragraph{}

II)@*
  If some thing is wrong in the @file{keybind.txt} file the program will inform the
error. The line number is for the @file{keybind.txt} and not for @file{keybind.cc} (Sorry,
some day I'll fix this).@*
To continue the execution press any key and then enter.
@paragraph{}

III)@*
  You can repeat an assignment, the last wins:
@paragraph{}

@smallexample
BACKSPACE = cmbNoCommand
BACKSPACE = cmbBackSpace
@end smallexample

  The first is ignored.
@paragraph{}

@section A program to find the scancodes
@cindex scan codes

  The author of the following program is @RH{}:
@paragraph{}

@format
#include <stdio.h>
#include <dos.h>

#ifdef __GNUC__
#include <dpmi.h>
#define REGS __dpmi_regs
#define INTR(nr,r) __dpmi_int(nr,&r)
#else
#define REGS union REGS
#define INTR(nr,r) int86(nr,&r,&r)
#endif

unsigned short getshiftstate(void)
@{
  REGS r;
  r.h.ah = 0x12;
  INTR(0x16,r);
  return r.x.ax;
@}

unsigned short gkey(void)
@{
  REGS r;
  r.h.ah = 0x10;
  INTR(0x16,r);
  if (r.h.al == 0xE0 || r.h.al == 0) r.h.al = 0;
  return r.x.ax;
@}

main()
@{
  unsigned short key;
  do
  @{
    key = gkey();
    fprintf(stdout,"%04X, scan code: %d\n",key,key>>8);
  @} while (1);
@}
@end format

@chapter Editing Modes

  The editor has nine settings that control the function and aspect of
the editor. Not all can be controlled by RHIDE Beta 6 release 22/10, and
I don't know if all the settings will be supported in the 1.0 release so
if you don't find some setting in RHIDE and you feel that setting is
really needed contact me.
@paragraph{}

  The settings are:
@paragraph{}

@section Overwrite
@cindex Overwrite

  This setting controls if the typed characters are inserted in the buffer or
if the typed characters replace the original ones. @x{Insert and Delete}
for a detailed explanation.

@section Autoindent
@cindex Autoindent

  This setting controls what happend when you press @key{ENTER}. If this setting
is off the cursor goes to the column 1 of a new line. If the
mode is on the editor will try to keep the indentation of the code
inserting spaces.

@section Real Tabs
@cindex Real Tabs
@cindex Use Real Tabs
@cindex TABs

  This setting controls what happend when you press @kbd{@key{TAB}}. If this setting
is on the editor will insert an ASCII 9 in this place.
@paragraph{}

  An ASCII 9 is a TAB, that means that the width of this char is enough to
move the cursor to the next tabulator column. In the editor the tabulator
columns are equidistant and the positions are controled by the Tab Size value.
@paragraph{}

  If this setting is off the editor won't put any ASCII 9 in your text.
Instead the editor will insert enough spaces to move the cursor to the
next tab-stop, but if the cursor is positioned on the first character of
the line the editor will insert spaces to move this position to the next
hole in the line over the line where you are. Confused? Sorry for my
English, an example will clarify that:
@paragraph{}

This is a line over the line where you are
@paragraph{}

That's the line where the cursor is, at column one.
@paragraph{}

  After pressing TAB you'll get:
@paragraph{}

This is a line over the line where you are
@paragraph{}

     That's the line where the cursor is, at column one.
@paragraph{}

  Now can ask, Why this? Is that useful? The answer is that's very useful
to keep your code indented, experiment using that under a line with if, for,
@i{etc.}
@paragraph{}

  Another thing controlled by this setting is the behaviour of the
@key{Backspace} key, when the setting is on the key is just 'delete the
character at the left of the cursor' but when the setting is off this
key is the 'Unindent' key.
@paragraph{}

  The editor is much more coherent when you choose to use TABs or not use
TABs. If you mix the two modes you'll get some unexpected things, specially
in the indentation of the blocks.
@paragraph{}

  Is better if you always work in a file without tabs and with this setting
off. Then you'll get much from the editor.
@paragraph{}

  Now you can say: @samp{But I really need tabs because I'm editing a make file!} or
@samp{because I'll send the file using an ultra slow link and I want the compression
granted by the tabs.} In these cases you can first expand all tabs, then
work without real tabs and at the finish of your work compact all possible
spaces and generate a file with all the tabs that you need.
@x{Miscellaneous} section.
@paragraph{}

@section Persistent Blocks

  This setting controls the behaviour of the selected area.
@paragraph{}
  @x{Block modes} chapter for a detailed explanation.
@paragraph{}

@section Intelligent C indent
@cindex Intelligent C indent

  This mode was designed to be used in jointly with the Pseudo Macros
(@x{Pseudo Macros}) and the Real Tabs mode in off to achieve an
easy way to indent the code making a better work than the Autoindent mode.
@paragraph{}

  In this mode the spaces inserted after pressing @key{ENTER} depend on
the first word in the last line. For example, if you have:
@paragraph{}

@smallexample
if (a==b)_
@end smallexample

  With the cursor in the '_' position and press @key{ENTER} you'll get:
@paragraph{}

@smallexample
if (a==b)
  _
@end smallexample

  Now you can do either of two things, 1) press space and write the code that will
be executed by the if, or 2) if this a multiline code press @{ and @key{ENTER}.
In the last case you'll get:

@smallexample
if (a==b)
  @{
   _
@end smallexample

  Now type your first line of code. Press @key{ENTER}. Write your next line.
Press @key{ENTER} again and then @key{Backspace}:

@smallexample
if (a==b)
  @{
   1st line;
   2nd line;
  _
@end smallexample

  Now type @} and press @key{ENTER} one more time:

@smallexample
if (a==b)
  @{
   1st line;
   2nd line;
  @}
_
@end smallexample

  As you can see the code is perfectly aligned without a significant work
on your part.
@paragraph{}

  I tried to make this mode as smart as possible, but needs more work. If
you have suggestions contact me.
@paragraph{}

  Another important thing is that this indentation has a personal style,
my style ;-), so maybe you don't like it. If that's your case you can
do the following things:
@paragraph{}

@itemize @bullet
  @item Use another way of indentation offered by the editor. For example,
turn on the Real Tabs mode and indent with tabs.
  @item Customize the @file{pmacros.txt} file (@x{Pseudo Macros}), actually this
file is coherent with this mode.
  @item The editor isn't configurable like Emacs or Brief using a language,
but is written in C++ and chances that you know C++ are over the
90% so contact me and I'll help you to write the routines that you
need to get an indentation in your own style :-).
@end itemize

@subsection Can you explain to me more about the behavior of this mode?

  I'll try to describe the behaviour of the mode:
@paragraph{}
  Each time you press @key{ENTER} the editor inserts a @samp{\r\n} string in your
text, after that the editor searchs one line located above the new line that
has at least one character inside. This line is taken as reference. The
editor analyzes this line searching for:
@paragraph{}

@itemize @bullet
   @item The first non-blank character on this line.
   @item The first word on this line.
   @item The first parenthesis.
   @item The balance of parentheses on the line.
   @item The last non-blank and non-comment character in the line.
@end itemize

  Now, if the line contains @{ at the start the editor goes to the first
column after the @{.
@paragraph{}
  If the line contains @} at the start the editor will go to the same column
of the @} and then will perform a @key{Backspace}. If the Real Tabs
mode is off, that's an unindent. @x{Real Tabs}.
@paragraph{}
  If the line starts with a C++ comment the effect is the same as in
Autoindent. @x{Autoindent}.
@paragraph{}
  If the line starts with a C comment the editor will try to skip the
comment and analyze the rest of the line, but if the comment doesn't end
on this line the editor will go to the column where the @samp{/} is.
@paragraph{}
  If the line starts with @samp{/} the editor goes to this column.
@paragraph{}
  If the line has more @samp{(} than @samp{)} the editor will go to the column of the
first non-blank after the first @samp{(}.
@paragraph{}
  If the line has more @samp{)} than @samp{(} the editor will search the line where the
number of parentheses is balanced, then will analyze this line. If the whole
line still generates an unbalanced situation the editor will go to the
first used column in the line that was found the first time. But if this
line lets all balanced the editor will take the first word on the line and
will use it as reference.
@paragraph{}
  At last, and according to the word found, the editor will use this
word as reference. The editor recognises the following keywords:
@paragraph{}

@table2_auto{Keyword,Action}
@clear table-set-center
@titem_{@samp{do},+2 but not if @dots{} ;}
@titem_{@samp{if},+2 but not if @dots{} ;}
@titem_{@samp{for},+3 but not if @dots{} ;}
@titem_{@samp{else},+2}
@titem_{@samp{case},+5}
@titem_{@samp{while},+2 but not if @dots{} ;}
@titem_{@samp{switch},+2}
@titem_{@samp{break},unindent}
@titem_{@samp{return},unindent}
@titem_{@samp{default},+5}
@endtable_{}

  The numbers are how many spaces are added with reference to the first letter
of the word.  'not if @dots{} ;' specified means that, if the line ends with
a semicolon, the editor will do the same as for Autoindent. @x{Autoindent}. The
unindent is performed with @key{Backspace}.
@paragraph{}

  Seasick? @x{Do you have more examples?}.
@paragraph{}

  Note: Some of these features were added in v0.2.14 of the editor based on a
suggestion of @email{Bradford L.@: Spencer, stud73@@nortel.ca} about the
behaviour of the mode on a line like this @samp{printf("Num: %d",} with the
rest of the parameters on the next line.
@paragraph{}

@subsection Do you have more examples?

  Well here are some examples. I used a strange convention, like this:
if I say type `a[ENTER]@{', type the letter @kbd{a}, then press @kbd{@key{ENTER}} and
finally press the `@{' key.
@paragraph{}

Example 1: (Is similar to one explained before but is to show the
convention)
@paragraph{}

@smallexample
Type:
if (a==1)[ENTER]@{[ENTER]a=2;[ENTER]b=3;[ENTER][BACKSPACE]@}[ENTER]

You'll get:

if (a==1)
  @{
   a=2;
   b=3;
  @}
[<--- cursor here]
@end smallexample


Example 2: A switch/case example
@paragraph{}

@smallexample
Type:
switch(a)[ENTER]@{[ENTER]case 1:[ENTER]a=2;[ENTER]b=3;[ENTER]break;
[ENTER]case 2:[ENTER]b=5;[ENTER]break;[ENTER][BACKSPACE]@}[ENTER]

You'll get:

switch(a)
  @{
   case 1:
        a=2;
        b=3;
        break;
   case 2:
        b=5;
        break;
  @}
[<--- cursor here]
@end smallexample


Example 3: A call to a function that takes a lot of parameters
@paragraph{}

@smallexample
Type:
printf([SPACE]"Num: %d",[ENTER]a[SPACE]);[ENTER]

You'll get:

printf( "Num: %d",
        a );
[<--- cursor here]
@end smallexample


Example 4: A lot of parentheses
@paragraph{}

@smallexample
Type:
if[SPACE]([SPACE](a==1)[SPACE]||[ENTER](b==2)[SPACE]||[ENTER]
c[SPACE])[ENTER]

You'll get:

if ( (a==1) ||
     (b==2) ||
     c )
  [<--- cursor here]
@end smallexample


Example 5: Comment trying to interfere part 1
@paragraph{}

@smallexample
Type:
/*-a-*/for[SPACE](x=1;x;--x)[ENTER]

You'll get:

/*-a-*/for (x=1;x;--x)
          [<--- cursor here]
@end smallexample


Example 6: Comment trying to interfere part 2
@paragraph{}

@smallexample
Type:
for[SPACE](x=1;x;--x);[SPACE]//-b[ENTER]

You'll get:

for (x=1;x;--x); //-b
[<--- cursor here]
@end smallexample


 Note: Of course you can fool the editor but as you can see it is relatively
smart ;-).
@paragraph{}

@section Column cursor
@cindex Column cursor

  This setting enables an strange feature of the editor, when this mode is
on the column where the cursor is is highlighted. This feature is very good
to check if some part of your code is aligned.
@paragraph{}

  If you like this mode but is very uncomfortable to use all the time
contact me and if I get enough feedback I'll put this thing in a key to be
turned on/off quickly.
@paragraph{}

@section Row cursor
@cindex Row cursor

  This setting is similar to the column cursor but acts on the row
where the cursor is. If you enable the two modes you'll get a cross on the
screen showing where the cursor is.
@paragraph{}

@section Match pair highlight
@cindex Match pair highlight

  This mode acts showing the pairs of (/), [/] and @{/@} on the fly. Each
time you type one of these symbols the editor will search the matching
pair, if the editor finds it and the match is on the screen both will be
highlighted, if the match is outside the screen the editor will inform the
position on the status line, and if there is no match the editor will
inform the situation in the status line too.
@paragraph{}

  That's very useful when you are typing complex parenthetical expressions or
a very nested code. You can use it jointly with the @code{cmbSearchStart},
@code{cmbSearchEnd}, @code{cmbSearchOpPar}, @code{cmbSearchClPar}, @code{cmbSearchOpCor} and
@code{cmbSearchClCor} commands. (@x{Miscellaneous}).
@paragraph{}

@section Syntax Highlight

  The editor can highlight the syntax of your code. The available modes
are:
@paragraph{}

@itemize @bullet
  @item No highlight, all the code is with the same color.
  @item C/C++ Highlight.
  @item Pascal Highlight.
  @item Clipper Highlight.
@end itemize

  The kind of highlight is chosen automatically in RHIDE using the extention
of the file.
@paragraph{}

  The C/C++ highlight was designed for the GNU C compiler.
@paragraph{}
  The Pascal highlight was designed for the GNU Pascal compiler.
@paragraph{}
  The Clipper highlight was designed for the CA-Clipper 5 compiler.
@paragraph{}

@chapter Calculator

  The calculator inside the editor was made by Laszlo Molnar. Laszlo is a
friend of mine from Hungary and is the author of the great DJP progam (a
djgpp exe's compressor).
@paragraph{}
  The sources of the calculator are in the @file{parser.c} file. They are
free and you can use it for any purpose.
@paragraph{}
  Here is the documentation of the calculator written by Laszlo:
@paragraph{}

  The purpose of this program, to provide a simple but powerful
'calculator' for programmers, to help with coding and debugging, where GDB's
expression evaluator is not enough.
@paragraph{}

  You may say "Hey, I can write a better one with @i{flex} and @i{bison}", and you
may be right. I can make a better one too. But it'll be 4-5 times longer!
This calculator is only 10 kbytes of C code. What I think? It's not that bad.
@paragraph{}

  The parser algorithm I use is called 'Operator Precedence Parsing'
(I translated this from Hungarian, so I may be wrong ;-). It
works with 'operator precedence grammars' (a subset of LR(1) grammars),
which means that there can't be two non-terminating tokens next to each other
on the right side of your grammar rules. It's ideal for expression
evaluation.
@paragraph{}

  With this parser you can use numbers, operators, parentheses and functions
like in C.
@paragraph{}

Here are the operators in decreasing precedence:
@paragraph{}

@enumerate
@item
@code{~} unary not
@code{-} unary minus
@item
@code{**} power
@item
@code{*} multiplication
@code{/} division
@code{%} modulo
@item
@code{+} plus
@code{-} binary minus
@item
@code{@lt{}@lt{}} shift left
@code{@gt{}@gt{}} shift right
@item
@code{&} logical and
@item
@code{^} logical xor
@item
@code{|} logical or
@end enumerate
@paragraph{}

  The calculator includes the following functions:
@i{sin\, cos\, tan\, sinh\, cosh\, tanh\, asin\, acos\, atan\, log\, log10\, exp\, abs\,
sqrt\, ceil} and @i{floor}.  They work as you expected.  Additionally the
calculator provides some radix conversion routines: @i{bin\, oct\, dec} and @i{hex}.
@paragraph{}

  The calculator uses doubles, but you can use numbers in the usual integer
formats also: 0x@dots{} for base 16, 0b@dots{} for base 2 and 0@dots{} for
base 8.  The result of the calculation is displayed as a double for base 10,
and converted to long long format for the other radixes.
@paragraph{}

Error codes:
@paragraph{}

@table2{Number,Meaning}
@titem_{-1,yylex()   failed @i{e.g.@:}  \@samp\{1+#\}}
@titem_{-3,yyparse() failed @i{e.g.@:}  \@samp\{1+2)\}}
@titem_{-4,floating point exception @i{e.g.@:} \@samp\{sqrt(-1)\}}
@endtable_{}

@chapter How to contact me
@cindex How to contact me

  If you have any suggestions or bug report contact me at the address shown
in the author section. @x{About the Author}.
@paragraph{}

@section Bugs
@cindex Bugs

  If you find a bug please contact me, the Undo thing is the most complex
one and I know that needs some work on it.
@paragraph{}

  When reporting a bug please don't tell me: Some times some strange thing
happend @dots{} Try to find a pattern to the problem. What situation triggers
the problem? @dots{} with which file(s)? Then send me the file and the description.
@paragraph{}

  When sending to me a file UUEncode it to avoid problems related with the
e-mail.
@paragraph{}

@chapter Index

@conindex{cindex.idx,cindex.tdx}

@chapter Index of key commands

@keyindex{kindex.idx,kindex.tdx}

@contents

@bye

